1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

core: Initialize logging before admin

We'll see how this goes.

https://caddy.community/t/calling-the-admin-api-from-within-a-route-route-causes-a-deadlock/11319
This commit is contained in:
Matthew Holt 2021-02-23 12:57:10 -07:00
parent f6bb02b303
commit a8fdc0a998
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -325,21 +325,10 @@ func run(newCfg *Config, start bool) error {
// been set by a short assignment // been set by a short assignment
var err error var err error
// start the admin endpoint (and stop any prior one)
if start {
err = replaceLocalAdminServer(newCfg)
if err != nil {
return fmt.Errorf("starting caddy administration endpoint: %v", err)
}
}
if newCfg == nil { if newCfg == nil {
newCfg = new(Config) newCfg = new(Config)
} }
// prepare the new config for use
newCfg.apps = make(map[string]App)
// create a context within which to load // create a context within which to load
// modules - essentially our new config's // modules - essentially our new config's
// execution environment; be sure that // execution environment; be sure that
@ -373,6 +362,17 @@ func run(newCfg *Config, start bool) error {
return err return err
} }
// start the admin endpoint (and stop any prior one)
if start {
err = replaceLocalAdminServer(newCfg)
if err != nil {
return fmt.Errorf("starting caddy administration endpoint: %v", err)
}
}
// prepare the new config for use
newCfg.apps = make(map[string]App)
// set up global storage and make it CertMagic's default storage, too // set up global storage and make it CertMagic's default storage, too
err = func() error { err = func() error {
if newCfg.StorageRaw != nil { if newCfg.StorageRaw != nil {