summaryrefslogtreecommitdiff
path: root/caddy.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-02-23 12:57:10 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2021-02-23 12:57:10 -0700
commita8fdc0a9987817173cc24016af1afb1ef09c0776 (patch)
tree3481f015d600c3715656bfe8a450bce5768228cc /caddy.go
parentf6bb02b303d4a24c6932fd832f7aa9de224b6833 (diff)
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
Diffstat (limited to 'caddy.go')
-rw-r--r--caddy.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/caddy.go b/caddy.go
index 70135ff..a56529c 100644
--- a/caddy.go
+++ b/caddy.go
@@ -325,21 +325,10 @@ func run(newCfg *Config, start bool) error {
// been set by a short assignment
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 {
newCfg = new(Config)
}
- // prepare the new config for use
- newCfg.apps = make(map[string]App)
-
// create a context within which to load
// modules - essentially our new config's
// execution environment; be sure that
@@ -373,6 +362,17 @@ func run(newCfg *Config, start bool) error {
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
err = func() error {
if newCfg.StorageRaw != nil {