Skip to content

Commit

Permalink
core: Initialize logging before admin
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Feb 23, 2021
1 parent f6bb02b commit a8fdc0a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions caddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a8fdc0a

Please sign in to comment.