summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2022-04-03 12:04:33 -0400
committerGitHub <[email protected]>2022-04-03 12:04:33 -0400
commit22d8edb984b9a0cbe5d205f823b455920464bb95 (patch)
tree17e0823c7dfcb14850723ce47652265b0b219289 /cmd
parent734acc776a1156d22dabedd420053d834663a22e (diff)
downloadcaddy-22d8edb984b9a0cbe5d205f823b455920464bb95.tar.gz
caddy-22d8edb984b9a0cbe5d205f823b455920464bb95.zip
cmd: Fix defaulting admin address if empty in config, fixes `reload` (#4674)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/commandfuncs.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index 332374013..3cbe85b90 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -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"`
@@ -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
+ }
}
}