Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
tls: Do away with SetDefaults which did nothing useful
CertMagic uses the same defaults for us
Matthew Holt committed
Sep 12, 2019 at 17:31 UTC
ed40a5dcab80f17d63c3fba83349004eac3c7930
3 files changed
+1
-28
modules/caddyhttp/caddyhttp.go
-1
@@ -337,7 +337,6 @@ func (app *App) automaticHTTPS() error {
337
},
338
},
339
}
340
- acmeManager.SetDefaults()
340
tlsApp.Automation.Policies = append(tlsApp.Automation.Policies,
341
caddytls.AutomationPolicy{
342
Hosts: domainsForCerts,
modules/caddytls/acmemanager.go
-24
@@ -91,33 +91,9 @@ func (m *ACMEManagerMaker) Provision(ctx caddy.Context) error {
91
m.Storage = nil // allow GC to deallocate - TODO: Does this help?
92
}
93
94
- m.SetDefaults()
95
-
94
return nil
95
}
96
99
-// SetDefaults sets necessary values that are
100
-// currently empty to their default values.
101
-func (m *ACMEManagerMaker) SetDefaults() {
102
- // TODO: Setting all these defaults might not be necessary
103
- // since CertMagic should fill them in for us...
104
- if m.CA == "" {
105
- m.CA = certmagic.Default.CA
106
- }
107
- if m.Email == "" {
108
- m.Email = certmagic.Default.Email
109
- }
110
- if m.RenewAhead == 0 {
111
- m.RenewAhead = caddy.Duration(certmagic.Default.RenewDurationBefore)
112
- }
113
- if m.keyType == "" {
114
- m.keyType = certmagic.Default.KeyType
115
- }
116
- if m.storage == nil {
117
- m.storage = certmagic.Default.Storage
118
- }
119
-}
120
-
97
// makeCertMagicConfig converts m into a certmagic.Config, because
98
// this is a special case where the default manager is the certmagic
99
// Config and not a separate manager.
modules/caddytls/tls.go
+1
-3
@@ -197,9 +197,7 @@ func (t *TLS) getAutomationPolicyForName(name string) AutomationPolicy {
197
}
198
199
// default automation policy
200
- mgmt := new(ACMEManagerMaker)
201
- mgmt.SetDefaults()
202
- return AutomationPolicy{Management: mgmt}
200
+ return AutomationPolicy{Management: new(ACMEManagerMaker)}
201
}
202
203
// CertificatesWithSAN returns the list of all certificates