diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d562eb6850..d05eadfc3c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,8 @@ release. - Clarify environment variable substitution is not recursive ([#3913](https://github.com/open-telemetry/opentelemetry-specification/pull/3913)) +- Allow `env:` prefix in environment variable substitution syntax. + ([#3974](https://github.com/open-telemetry/opentelemetry-specification/pull/3974)) ### Common diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index 4b34f951ed0..44debb95998 100644 --- a/specification/configuration/file-configuration.md +++ b/specification/configuration/file-configuration.md @@ -72,14 +72,14 @@ Configuration files support environment variables substitution for references which match the following regular expression: ```regexp -\$\{(?[a-zA-Z_][a-zA-Z0-9_]*)(:-(?[^\n]*))?} +\$\{(?:env:)?(?[a-zA-Z_][a-zA-Z0-9_]*)(:-(?[^\n]*))?} ``` The `ENV_NAME` MUST start with an alphabetic or `_` character, and is followed by 0 or more alphanumeric or `_` characters. -For example, `${API_KEY}` is valid, while `${1API_KEY}` and `${API_$KEY}` are -invalid. +For example, `${API_KEY}` and `${env:API_KEY}` are valid, while `${1API_KEY}` +and `${API_$KEY}` are invalid. Environment variable substitution MUST only apply to scalar values. Mapping keys are not candidates for substitution. @@ -115,6 +115,7 @@ export REPLACE_ME='${DO_NOT_REPLACE_ME}' # A valid replacement text ```yaml string_key: ${STRING_VALUE} # Valid reference to STRING_VALUE +env_string_key: ${env:STRING_VALUE} # Valid reference to STRING_VALUE other_string_key: "${STRING_VALUE}" # Valid reference to STRING_VALUE inside double quotes another_string_key: "${BOOl_VALUE}" # Valid reference to BOOl_VALUE inside double quotes yet_another_string_key: ${INVALID_MAP_VALUE} # Valid reference to INVALID_MAP_VALUE, but YAML structure from INVALID_MAP_VALUE MUST NOT be injected @@ -132,6 +133,7 @@ Environment variable substitution results in the following YAML: ```yaml string_key: value # Interpreted as type string, tag URI tag:yaml.org,2002:str +env_string_key: value # Interpreted as type string, tag URI tag:yaml.org,2002:str other_string_key: "value" # Interpreted as type string, tag URI tag:yaml.org,2002:str another_string_key: "true" # Interpreted as type string, tag URI tag:yaml.org,2002:str yet_another_string_key: "value\nkey:value" # Interpreted as type string, tag URI tag:yaml.org,2002:str