Commit e6a3e5e1 authored by M. Ángel Jimeno's avatar M. Ángel Jimeno Committed by Matt Holt

cmd: rename -env to -envfile and use -env to print the environment (#2517)

* caddy: Rename env flag to envfile

* caddy: Add env flag to print environment variables
parent 397d6787
......@@ -53,7 +53,8 @@ func init() {
flag.StringVar(&disabledMetrics, "disabled-metrics", "", "Comma-separated list of telemetry metrics to disable")
flag.StringVar(&conf, "conf", "", "Caddyfile to load (default \""+caddy.DefaultConfigFile+"\")")
flag.StringVar(&cpu, "cpu", "100%", "CPU cap")
flag.StringVar(&envFile, "env", "", "Path to file with environment variables to load in KEY=VALUE format")
flag.BoolVar(&printEnv, "env", false, "Enable to print environment variables")
flag.StringVar(&envFile, "envfile", "", "Path to file with environment variables to load in KEY=VALUE format")
flag.BoolVar(&fromJSON, "json-to-caddyfile", false, "From JSON stdin to Caddyfile stdout")
flag.BoolVar(&plugins, "plugins", false, "List installed plugins")
flag.StringVar(&certmagic.Email, "email", "", "Default ACME CA account email address")
......@@ -117,6 +118,12 @@ func Run() {
mustLogFatalf("%v", err)
}
if printEnv {
for _, v := range os.Environ() {
fmt.Println(v)
}
}
// initialize telemetry client
if EnableTelemetry {
err := initTelemetry()
......@@ -580,6 +587,7 @@ var (
toJSON bool
version bool
plugins bool
printEnv bool
validate bool
disabledMetrics string
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment