Skip to content

Commit

Permalink
cmd: Fix defaulting admin address if empty in config, fixes reload (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie committed Apr 3, 2022
1 parent 734acc7 commit 22d8edb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/commandfuncs.go
Expand Up @@ -735,7 +735,7 @@ func DetermineAdminAPIAddress(address, configFile, configAdapter string) (string
return "", fmt.Errorf("no config file to load")
}

// get the address of the admin listener
// get the address of the admin listener if set
if len(config) > 0 {
var tmpStruct struct {
Admin caddy.AdminConfig `json:"admin"`
Expand All @@ -744,7 +744,9 @@ func DetermineAdminAPIAddress(address, configFile, configAdapter string) (string
if err != nil {
return "", fmt.Errorf("unmarshaling admin listener address from config: %v", err)
}
return tmpStruct.Admin.Listen, nil
if tmpStruct.Admin.Listen != "" {
return tmpStruct.Admin.Listen, nil
}
}
}

Expand Down

0 comments on commit 22d8edb

Please sign in to comment.