docs: Add valid character restrictions for env var interpolation#25801
docs: Add valid character restrictions for env var interpolation#25801balobe wants to merge 1 commit into
Conversation
|
Thank you for your contribution! Before we can merge this PR, please sign our Contributor License Agreement. To sign, copy and post the phrase below as a new comment on this PR.
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a990f2aa9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ## Variable name restrictions | ||
|
|
||
| Environment variable names used in interpolation are restricted to letters, digits plus `_` and `.` characters. | ||
| Names containing other characters (such as hyphens `-`) will not be interpolated. |
There was a problem hiding this comment.
Clarify that hyphens can still trigger interpolation
For hyphenated placeholders this says they “will not be interpolated,” but the interpolation regex in src/config/vars.rs still matches the valid prefix for $FOO-BAR and treats ${FOO-BAR} as the documented - default-value form. In configs that contain Kubernetes-style names or other hyphenated placeholders, users following this reference may expect the text to remain literal when Vector can instead substitute $FOO, emit a missing-var error, or resolve ${FOO-BAR} to BAR; the docs should say unsupported characters terminate the variable name / enter operator syntax and advise escaping or preprocessing.
Useful? React with 👍 / 👎.
Summary
Vector's environment variable interpolation silently ignores variable names containing hyphens (e.g. ${my-var}), passing them through as literal strings. This is because the interpolation regex in src/config/vars.rs (lines 5–17) restricts variable names to letters (upper and lowercase), digits, underscores, and dots. This constraint was undocumented, making it hard to
debug.
This PR adds a note to the environment variables reference to document this restriction.
Vector configuration
NA
How did you test this PR?
Ran the website locally with make serve and verified the guide renders correctly, including the embedded configuration files.
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
NA