fix(acme): fix config name

fix config name

Signed-off-by: kovacs <mritd@linux.com>
This commit is contained in:
kovacs 2024-05-27 12:45:50 +08:00
parent 3024fc079c
commit 3c22e5967f
No known key found for this signature in database
GPG key ID: 150E1851F767CDDD
3 changed files with 20 additions and 10 deletions

View file

@ -98,7 +98,7 @@ type serverConfigACME struct {
}
type serverConfigACMEDNSProvider struct {
Name string `mapstructure:"provider"`
Name string `mapstructure:"name"`
Config map[string]string `mapstructure:"config"`
}
@ -333,40 +333,40 @@ func (c *serverConfig) fillTLSConfig(hyConfig *server.Config) error {
case "cloudflare":
cmIssuer.DNS01Solver = &certmagic.DNS01Solver{
DNSProvider: &cloudflare.Provider{
APIToken: c.ACME.DNSProvider.Config["CLOUDFLARE_API_TOKEN"],
APIToken: c.ACME.DNSProvider.Config["cloudflare_api_token"],
},
}
case "duckdns":
cmIssuer.DNS01Solver = &certmagic.DNS01Solver{
DNSProvider: &duckdns.Provider{
APIToken: c.ACME.DNSProvider.Config["DUCKDNS_API_TOKEN"],
OverrideDomain: c.ACME.DNSProvider.Config["DUCKDNS_OVERRIDE_DOMAIN"],
APIToken: c.ACME.DNSProvider.Config["duckdns_api_token"],
OverrideDomain: c.ACME.DNSProvider.Config["duckdns_override_domain"],
},
}
case "gandi":
cmIssuer.DNS01Solver = &certmagic.DNS01Solver{
DNSProvider: &gandi.Provider{
BearerToken: c.ACME.DNSProvider.Config["GANDI_API_TOKEN"],
BearerToken: c.ACME.DNSProvider.Config["gandi_api_token"],
},
}
case "godaddy":
cmIssuer.DNS01Solver = &certmagic.DNS01Solver{
DNSProvider: &godaddy.Provider{
APIToken: c.ACME.DNSProvider.Config["GODADDY_API_TOKEN"],
APIToken: c.ACME.DNSProvider.Config["godaddy_api_token"],
},
}
case "namedotcom":
cmIssuer.DNS01Solver = &certmagic.DNS01Solver{
DNSProvider: &namedotcom.Provider{
Token: c.ACME.DNSProvider.Config["NAMEDOTCOM_TOKEN"],
User: c.ACME.DNSProvider.Config["NAMEDOTCOM_USER"],
Server: c.ACME.DNSProvider.Config["NAMEDOTCOM_SERVER"],
Token: c.ACME.DNSProvider.Config["namedotcom_token"],
User: c.ACME.DNSProvider.Config["namedotcom_user"],
Server: c.ACME.DNSProvider.Config["namedotcom_server"],
},
}
case "vultr":
cmIssuer.DNS01Solver = &certmagic.DNS01Solver{
DNSProvider: &vultr.Provider{
APIToken: c.ACME.DNSProvider.Config["VULTR_API_TOKEN"],
APIToken: c.ACME.DNSProvider.Config["vultr_api_token"],
},
}
}

View file

@ -41,6 +41,12 @@ func TestServerConfig(t *testing.T) {
AltHTTPPort: 9980,
AltTLSALPNPort: 9443,
Dir: "random_dir",
DNSProvider: serverConfigACMEDNSProvider{
Name: "cloudflare",
Config: map[string]string{
"cloudflare_api_token": "xxxxxxxxxx",
},
},
},
QUIC: serverConfigQUIC{
InitStreamReceiveWindow: 77881,

View file

@ -20,6 +20,10 @@ acme:
altHTTPPort: 9980
altTLSALPNPort: 9443
dir: random_dir
dnsProvider:
name: "cloudflare"
config:
cloudflare_api_token: "xxxxxxxxxx"
quic:
initStreamReceiveWindow: 77881