From 063ed1e7f91b578c705147cb411d076865195174 Mon Sep 17 00:00:00 2001 From: Zaq? Wiedmann Date: Wed, 26 Feb 2020 15:06:34 -0800 Subject: caddyfile: expand environment variables within caddy files (#3082) Small expansion to the work done in https://github.com/caddyserver/caddy/pull/2963 which simply calls `os.ExpandEnv` so env vars like `{$URL}` where `$URL=$SCHEME://$HOST:$PORT` (contrived) get the expanded $SCHEME, $HOST, and $PORT variables included --- caddyconfig/caddyfile/parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caddyconfig/caddyfile/parse.go b/caddyconfig/caddyfile/parse.go index f376033..cdcac26 100755 --- a/caddyconfig/caddyfile/parse.go +++ b/caddyconfig/caddyfile/parse.go @@ -64,7 +64,7 @@ func replaceEnvVars(input []byte) ([]byte, error) { } // get the value of the environment variable - envVarValue := []byte(os.Getenv(string(envVarName))) + envVarValue := []byte(os.ExpandEnv(os.Getenv(string(envVarName)))) // splice in the value input = append(input[:begin], -- cgit v1.2.3