Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 09:15 UTC
caddypki: Prefer user-configured root instead of generating new one (#5189)
instead of generating a new root certificate at the default location load the certificate from the configuration. fixes: #5181
Jonathan Garcia committed
Nov 8, 2022 at 20:13 UTC
33fdea8f261c306a47b07a6df2c3cb8fe2ad2d5d
1 file changed
+3
modules/caddypki/ca.go
+3
@@ -240,6 +240,9 @@ func (ca *CA) NewAuthority(authorityConfig AuthorityConfig) (*authority.Authorit
240
}
241
242
func (ca CA) loadOrGenRoot() (rootCert *x509.Certificate, rootKey any, err error) {
243
+ if ca.Root != nil {
244
+ return ca.Root.Load()
245
+ }
246
rootCertPEM, err := ca.storage.Load(ca.ctx, ca.storageKeyRootCert())
247
if err != nil {
248
if !errors.Is(err, fs.ErrNotExist) {