From e6f6d3a4765565b09f95a29a2e75be34e1d70359 Mon Sep 17 00:00:00 2001 From: Jesse Date: Mon, 3 May 2021 02:38:16 +0800 Subject: cmd: Add --envfile flag to `start` command (#4141) * add envfile in start cmd * fix commandfuncs * fix commandfuncs * fix cmdStart envfile from bool to string Co-authored-by: Francis Lavoie --- cmd/commands.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd/commands.go') diff --git a/cmd/commands.go b/cmd/commands.go index a519896..36e9c04 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -74,18 +74,22 @@ func init() { RegisterCommand(Command{ Name: "start", Func: cmdStart, - Usage: "[--config [--adapter ]] [--watch] [--pidfile ]", + Usage: "[--config [--adapter ]] [--envfile ] [--watch] [--pidfile ]", Short: "Starts the Caddy process in the background and then returns", Long: ` Starts the Caddy process, optionally bootstrapped with an initial config file. This command unblocks after the server starts running or fails to run. +If --envfile is specified, an environment file with environment variables in +the KEY=VALUE format will be loaded into the Caddy process. + On Windows, the spawned child process will remain attached to the terminal, so closing the window will forcefully stop Caddy; to avoid forgetting this, try using 'caddy run' instead to keep it in the foreground.`, Flags: func() *flag.FlagSet { fs := flag.NewFlagSet("start", flag.ExitOnError) fs.String("config", "", "Configuration file") + fs.String("envfile", "", "Environment file to load") fs.String("adapter", "", "Name of config adapter to apply") fs.String("pidfile", "", "Path of file to which to write process ID") fs.Bool("watch", false, "Reload changed config file automatically") -- cgit v1.2.3