summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-04-04 13:29:25 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-04-04 13:29:48 -0600
commit346c33b4d5f313bb2b864415e644ab56c5998e21 (patch)
tree997872d73fd32c4f2f73cb807f49b606d98aea7f
parent78717ce5b0a940df0ef91a19e8389b11505a344d (diff)
cmd: Log warning if --resume and --config used together
There's nothing actually risky/dangerous in this situation, it's mostly an attempt to get the user's attention
-rw-r--r--cmd/commandfuncs.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index 46de9de..efdcfdc 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -171,7 +171,15 @@ func cmdRun(fl Flags) (int, error) {
} else if err != nil {
return caddy.ExitCodeFailedStartup, err
} else {
- caddy.Log().Info("resuming from last configuration", zap.String("autosave_file", caddy.ConfigAutosavePath))
+ if runCmdConfigFlag == "" {
+ caddy.Log().Info("resuming from last configuration",
+ zap.String("autosave_file", caddy.ConfigAutosavePath))
+ } else {
+ // if they also specified a config file, user should be aware that we're not
+ // using it (doing so could lead to data/config loss by overwriting!)
+ caddy.Log().Warn("--config and --resume flags were used together; ignoring --config and resuming from last configuration",
+ zap.String("autosave_file", caddy.ConfigAutosavePath))
+ }
}
}
// we don't use 'else' here since this value might have been changed in 'if' block; i.e. not mutually exclusive