@marcel91200 / caddy Mirror · read-only / commits / 346c33b4
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

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

Matthew Holt committed Apr 4, 2020 at 13:29 UTC 346c33b4d5f313bb2b864415e644ab56c5998e21
1 file changed +9 -1
cmd/commandfuncs.go
+9 -1
@@ -171,7 +171,15 @@ func cmdRun(fl Flags) (int, error) {
171 } else if err != nil {
172 return caddy.ExitCodeFailedStartup, err
173 } else {
174 - caddy.Log().Info("resuming from last configuration", zap.String("autosave_file", caddy.ConfigAutosavePath))
174 + if runCmdConfigFlag == "" {
175 + caddy.Log().Info("resuming from last configuration",
176 + zap.String("autosave_file", caddy.ConfigAutosavePath))
177 + } else {
178 + // if they also specified a config file, user should be aware that we're not
179 + // using it (doing so could lead to data/config loss by overwriting!)
180 + caddy.Log().Warn("--config and --resume flags were used together; ignoring --config and resuming from last configuration",
181 + zap.String("autosave_file", caddy.ConfigAutosavePath))
182 + }
183 }
184 }
185 // we don't use 'else' here since this value might have been changed in 'if' block; i.e. not mutually exclusive