@marcel91200 / caddy Mirror · read-only / commits / a8fdc0a9
Fork 0

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

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

Matthew Holt committed Feb 23, 2021 at 12:57 UTC a8fdc0a9987817173cc24016af1afb1ef09c0776
1 file changed +11 -11
caddy.go
+11 -11
@@ -325,21 +325,10 @@ func run(newCfg *Config, start bool) error {
325 // been set by a short assignment
326 var err error
327
328 - // start the admin endpoint (and stop any prior one)
329 - if start {
330 - err = replaceLocalAdminServer(newCfg)
331 - if err != nil {
332 - return fmt.Errorf("starting caddy administration endpoint: %v", err)
333 - }
334 - }
335 -
328 if newCfg == nil {
329 newCfg = new(Config)
330 }
331
340 - // prepare the new config for use
341 - newCfg.apps = make(map[string]App)
342 -
332 // create a context within which to load
333 // modules - essentially our new config's
334 // execution environment; be sure that
@@ -373,6 +362,17 @@ func run(newCfg *Config, start bool) error {
362 return err
363 }
364
365 + // start the admin endpoint (and stop any prior one)
366 + if start {
367 + err = replaceLocalAdminServer(newCfg)
368 + if err != nil {
369 + return fmt.Errorf("starting caddy administration endpoint: %v", err)
370 + }
371 + }
372 +
373 + // prepare the new config for use
374 + newCfg.apps = make(map[string]App)
375 +
376 // set up global storage and make it CertMagic's default storage, too
377 err = func() error {
378 if newCfg.StorageRaw != nil {