-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(config): prohibit multiline interpolation [WIP] #22995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 3 Passed, 0 Skipped, 2.13s Total Time |
@@ -0,0 +1,297 @@ | |||
use std::{collections::HashMap, sync::LazyLock}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved vars.rs
to this location. But kept the same use/export.
deserialize_table(table) | ||
} | ||
|
||
pub fn resolve_environment_variables(table: Table) -> Result<Table, Vec<String>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was extracted from prepare_input
@@ -88,11 +89,10 @@ impl SecretBackendLoader { | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Currently (on master) we don't support multiple types for secrets.
2025-05-07T14:38:00.776983Z ERROR vector::cli: Configuration error. error=Error while retrieving secret from backend "backend_1": invalid type: integer `1`, expected a string at line 1 column 10.
However, interpolate_secrets
supports multiple types. I consider this out of scope for this PR but we could go further and allow e.g. integer secrets.
Fixed and added tests to cover this. |
This comment was marked as outdated.
This comment was marked as outdated.
So there are some tests failures:
Will fix (1) in a separate PR |
Still testing this. I found at least one bug for TOML configs. YAML configs seems to be working fine. |
…ore interpolation"
…onverted to array eventually)
62d735b
to
2cfe741
Compare
Summary
Warning
This PR has a very wide surface area. I will think if it is possible to split it.
Also, it is not actively worked on.
YAML config loading seems to be working fine, but TOML configs have a few bugs.
The envinronment variable (and the secrets) resolution now happens after the config string is parsed into a TOML table. The interpolation now happens on the table keys and values. As a side effect, this fixes a bug where comments referring to env vars (or secrets) that don't exist caused a config build error.
Change Type
Is this a breaking change?
Injecting whole blocks now results in error e.g.
${SOURCES_BLOCK}
The config above will fail to load.
How did you test this PR?
Vector config:
Output:
Does this PR include user facing changes?
Notes
@vectordotdev/vector
to reach out to us regarding this PR.pre-push
hook, please see this template.cargo fmt --all
cargo clippy --workspace --all-targets -- -D warnings
cargo nextest run --workspace
(alternatively, you can runcargo test --all
)./scripts/check_changelog_fragments.sh
git merge origin master
andgit push
.Cargo.lock
), pleaserun
cargo vdev build licenses
to regenerate the license inventory and commit the changes (if any). More details here.References