aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/commandfuncs.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2020-01-22 10:04:58 -0700
committerMatthew Holt <[email protected]>2020-01-22 10:04:58 -0700
commit6614d1c495f3266037d36b4c2f4f70fcc73acad1 (patch)
treed8734657bd1243bc80f970f16b6dc9c6c6982984 /cmd/commandfuncs.go
parentc6bddbfbe25b2123a1b53a7a705283d68bc4109a (diff)
downloadcaddy-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.go7
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