1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

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
This commit is contained in:
Zaq? Wiedmann 2020-02-26 15:06:34 -08:00 committed by GitHub
parent 2de0acc11f
commit 063ed1e7f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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],