Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 20:30 UTC
cmd: Fix defaulting admin address if empty in config, fixes `reload` (#4674)
Francis Lavoie committed
Apr 3, 2022 at 12:04 UTC
22d8edb984b9a0cbe5d205f823b455920464bb95
1 file changed
+4
-2
cmd/commandfuncs.go
+4
-2
@@ -735,7 +735,7 @@ func DetermineAdminAPIAddress(address, configFile, configAdapter string) (string
735
return "", fmt.Errorf("no config file to load")
736
}
737
738
- // get the address of the admin listener
738
+ // get the address of the admin listener if set
739
if len(config) > 0 {
740
var tmpStruct struct {
741
Admin caddy.AdminConfig `json:"admin"`
@@ -744,7 +744,9 @@ func DetermineAdminAPIAddress(address, configFile, configAdapter string) (string
744
if err != nil {
745
return "", fmt.Errorf("unmarshaling admin listener address from config: %v", err)
746
}
747
- return tmpStruct.Admin.Listen, nil
747
+ if tmpStruct.Admin.Listen != "" {
748
+ return tmpStruct.Admin.Listen, nil
749
+ }
750
}
751
}
752