Browse Source

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
master
Zaq? Wiedmann 5 years ago
committed by GitHub
parent
commit
063ed1e7f9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      caddyconfig/caddyfile/parse.go

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

Loading…
Cancel
Save