mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	httpcaddyfile: Add resolvers subdir of tls (close #4008)
Allows conveniently setting the resolvers for the DNS challenge using a TLS subdirective, which applies to default issuers, rather than having to explicitly define the issuers and overwrite the defaults.
This commit is contained in:
		
							parent
							
								
									bf50d7010a
								
							
						
					
					
						commit
						8c291298c9
					
				@ -316,6 +316,8 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
 | 
			
		||||
				}
 | 
			
		||||
				if acmeIssuer.Challenges == nil {
 | 
			
		||||
					acmeIssuer.Challenges = new(caddytls.ChallengesConfig)
 | 
			
		||||
				}
 | 
			
		||||
				if acmeIssuer.Challenges.DNS == nil {
 | 
			
		||||
					acmeIssuer.Challenges.DNS = new(caddytls.DNSChallengeConfig)
 | 
			
		||||
				}
 | 
			
		||||
				modID := "dns.providers." + provName
 | 
			
		||||
@ -325,6 +327,22 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
 | 
			
		||||
				}
 | 
			
		||||
				acmeIssuer.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, h.warnings)
 | 
			
		||||
 | 
			
		||||
			case "resolvers":
 | 
			
		||||
				args := h.RemainingArgs()
 | 
			
		||||
				if len(args) == 0 {
 | 
			
		||||
					return nil, h.ArgErr()
 | 
			
		||||
				}
 | 
			
		||||
				if acmeIssuer == nil {
 | 
			
		||||
					acmeIssuer = new(caddytls.ACMEIssuer)
 | 
			
		||||
				}
 | 
			
		||||
				if acmeIssuer.Challenges == nil {
 | 
			
		||||
					acmeIssuer.Challenges = new(caddytls.ChallengesConfig)
 | 
			
		||||
				}
 | 
			
		||||
				if acmeIssuer.Challenges.DNS == nil {
 | 
			
		||||
					acmeIssuer.Challenges.DNS = new(caddytls.DNSChallengeConfig)
 | 
			
		||||
				}
 | 
			
		||||
				acmeIssuer.Challenges.DNS.Resolvers = args
 | 
			
		||||
 | 
			
		||||
			case "ca_root":
 | 
			
		||||
				arg := h.RemainingArgs()
 | 
			
		||||
				if len(arg) != 1 {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user