diff options
author | Matthew Holt <[email protected]> | 2020-01-22 10:04:58 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2020-01-22 10:04:58 -0700 |
commit | 6614d1c495f3266037d36b4c2f4f70fcc73acad1 (patch) | |
tree | d8734657bd1243bc80f970f16b6dc9c6c6982984 /cmd/commandfuncs.go | |
parent | c6bddbfbe25b2123a1b53a7a705283d68bc4109a (diff) | |
download | caddy-6614d1c495f3266037d36b4c2f4f70fcc73acad1.tar.gz caddy-6614d1c495f3266037d36b4c2f4f70fcc73acad1.zip |
cmd: Emit error if reload cannot find a config to loadv2.0.0-beta.13
Diffstat (limited to 'cmd/commandfuncs.go')
-rw-r--r-- | cmd/commandfuncs.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index 0067d3b60..8d522584d 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -171,7 +171,7 @@ func cmdRun(fl Flags) (int, error) { } // we don't use 'else' here since this value might have been changed in 'if' block; i.e. not mutually exclusive if !runCmdResumeFlag { - config, err = loadConfig(runCmdConfigFlag, runCmdConfigAdapterFlag) + config, _, err = loadConfig(runCmdConfigFlag, runCmdConfigAdapterFlag) if err != nil { return caddy.ExitCodeFailedStartup, err } @@ -265,10 +265,13 @@ func cmdReload(fl Flags) (int, error) { reloadCmdAddrFlag := fl.String("address") // get the config in caddy's native format - config, err := loadConfig(reloadCmdConfigFlag, reloadCmdConfigAdapterFlag) + config, hasConfig, err := loadConfig(reloadCmdConfigFlag, reloadCmdConfigAdapterFlag) if err != nil { return caddy.ExitCodeFailedStartup, err } + if !hasConfig { + return caddy.ExitCodeFailedStartup, fmt.Errorf("no config file to load") + } // get the address of the admin listener and craft endpoint URL adminAddr := reloadCmdAddrFlag |