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
caddytls: Support placeholders in key_type (#3176)
* tls: Support placeholders in key_type * caddytls: Simplify placeholder support for ap.KeyType Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>
Pascal committed
Mar 26, 2020 at 06:16 UTC
5c55e5d53fcd5f60921dc477a4eb2127fe20c577
1 file changed
+12
-1
modules/caddytls/automation.go
+12
-1
@@ -183,8 +183,19 @@ func (ap *AutomationPolicy) Provision(tlsApp *TLS) error {
183
ap.Issuer = val.(certmagic.Issuer)
184
}
185
186
+ keyType := ap.KeyType
187
+ if keyType != "" {
188
+ var err error
189
+ keyType, err = caddy.NewReplacer().ReplaceOrErr(ap.KeyType, true, true)
190
+ if err != nil {
191
+ return fmt.Errorf("invalid key type %s: %s", ap.KeyType, err)
192
+ }
193
+ if _, ok := supportedCertKeyTypes[keyType]; !ok {
194
+ return fmt.Errorf("unrecognized key type: %s", keyType)
195
+ }
196
+ }
197
keySource := certmagic.StandardKeyGenerator{
187
- KeyType: supportedCertKeyTypes[ap.KeyType],
198
+ KeyType: supportedCertKeyTypes[keyType],
199
}
200
201
storage := ap.storage