tls: Do away with SetDefaults which did nothing useful

CertMagic uses the same defaults for us
This commit is contained in:
Matthew Holt 2019-09-12 17:31:54 -06:00
parent 7799554baa
commit ed40a5dcab
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
3 changed files with 1 additions and 28 deletions

View file

@ -337,7 +337,6 @@ func (app *App) automaticHTTPS() error {
}, },
}, },
} }
acmeManager.SetDefaults()
tlsApp.Automation.Policies = append(tlsApp.Automation.Policies, tlsApp.Automation.Policies = append(tlsApp.Automation.Policies,
caddytls.AutomationPolicy{ caddytls.AutomationPolicy{
Hosts: domainsForCerts, Hosts: domainsForCerts,

View file

@ -91,33 +91,9 @@ func (m *ACMEManagerMaker) Provision(ctx caddy.Context) error {
m.Storage = nil // allow GC to deallocate - TODO: Does this help? m.Storage = nil // allow GC to deallocate - TODO: Does this help?
} }
m.SetDefaults()
return nil return nil
} }
// SetDefaults sets necessary values that are
// currently empty to their default values.
func (m *ACMEManagerMaker) SetDefaults() {
// TODO: Setting all these defaults might not be necessary
// since CertMagic should fill them in for us...
if m.CA == "" {
m.CA = certmagic.Default.CA
}
if m.Email == "" {
m.Email = certmagic.Default.Email
}
if m.RenewAhead == 0 {
m.RenewAhead = caddy.Duration(certmagic.Default.RenewDurationBefore)
}
if m.keyType == "" {
m.keyType = certmagic.Default.KeyType
}
if m.storage == nil {
m.storage = certmagic.Default.Storage
}
}
// makeCertMagicConfig converts m into a certmagic.Config, because // makeCertMagicConfig converts m into a certmagic.Config, because
// this is a special case where the default manager is the certmagic // this is a special case where the default manager is the certmagic
// Config and not a separate manager. // Config and not a separate manager.

View file

@ -197,9 +197,7 @@ func (t *TLS) getAutomationPolicyForName(name string) AutomationPolicy {
} }
// default automation policy // default automation policy
mgmt := new(ACMEManagerMaker) return AutomationPolicy{Management: new(ACMEManagerMaker)}
mgmt.SetDefaults()
return AutomationPolicy{Management: mgmt}
} }
// CertificatesWithSAN returns the list of all certificates // CertificatesWithSAN returns the list of all certificates