@marcel91200 / caddy Mirror · read-only / commits / 0d3f99e8
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: Add print-env flag to run command

Matthew Holt committed Jul 18, 2019 at 10:58 UTC 0d3f99e85a089a6a772ae38f426b5cd5f2f4583f
1 file changed +9
cmd/commands.go
+9
@@ -137,9 +137,18 @@ func cmdStart() (int, error) {
137 func cmdRun() (int, error) {
138 runCmd := flag.NewFlagSet("run", flag.ExitOnError)
139 runCmdConfigFlag := runCmd.String("config", "", "Configuration file")
140 + runCmdPrintEnvFlag := runCmd.Bool("print-env", false, "Print environment (useful for debugging)")
141 runCmdPingbackFlag := runCmd.String("pingback", "", "Echo confirmation bytes to this address on success")
142 runCmd.Parse(os.Args[2:])
143
144 + // if we are supposed to print the environment, do that first
145 + if *runCmdPrintEnvFlag {
146 + exitCode, err := cmdEnviron()
147 + if err != nil {
148 + return exitCode, err
149 + }
150 + }
151 +
152 // if a config file was specified for bootstrapping
153 // the server instance, load it now
154 var config []byte