diff options
author | Matthew Holt <[email protected]> | 2020-01-22 09:33:22 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2020-01-22 09:33:22 -0700 |
commit | 9a1370c2c8fb2c52585971d9eaa6f0c4383cb869 (patch) | |
tree | 828aeee845d6e5fca83050c1e51557a5e996051b /cmd/commandfuncs.go | |
parent | d810637a9fe2d2015b1f5ad701fdc23f26dda66a (diff) | |
download | caddy-9a1370c2c8fb2c52585971d9eaa6f0c4383cb869.tar.gz caddy-9a1370c2c8fb2c52585971d9eaa6f0c4383cb869.zip |
cmd: Make --config flag optional for reload command
In case it is using the default Caddyfile
Diffstat (limited to 'cmd/commandfuncs.go')
-rw-r--r-- | cmd/commandfuncs.go | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index 83fc52d5c..0067d3b60 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -264,12 +264,6 @@ func cmdReload(fl Flags) (int, error) { reloadCmdConfigAdapterFlag := fl.String("adapter") reloadCmdAddrFlag := fl.String("address") - // a configuration is required - if reloadCmdConfigFlag == "" { - return caddy.ExitCodeFailedStartup, - fmt.Errorf("no configuration to load (use --config)") - } - // get the config in caddy's native format config, err := loadConfig(reloadCmdConfigFlag, reloadCmdConfigAdapterFlag) if err != nil { @@ -278,7 +272,7 @@ func cmdReload(fl Flags) (int, error) { // get the address of the admin listener and craft endpoint URL adminAddr := reloadCmdAddrFlag - if adminAddr == "" { + if adminAddr == "" && len(config) > 0 { var tmpStruct struct { Admin caddy.AdminConfig `json:"admin"` } |