feat(agent-config): allow extensible configuration via ConfigExtension trait#111
Open
duncanista wants to merge 4 commits intomainfrom
Open
feat(agent-config): allow extensible configuration via ConfigExtension trait#111duncanista wants to merge 4 commits intomainfrom
duncanista wants to merge 4 commits intomainfrom
Conversation
…n trait Introduces a generic `Config<E: ConfigExtension>` type that lets consumers define additional configuration fields without modifying or copy-pasting the core crate. Includes a unified `Source` type for dual extraction from both env vars and YAML, a `merge_fields!` macro to reduce merge boilerplate, and moves Lambda-specific fields out of the core Config struct. Also restructures the crate to use a conventional `src/` layout and adds a README documenting the extension API.
…s/ modules Move config source implementations (env, yaml) into `src/sources/` and type definitions with custom deserialization into `src/deserializers/`. Re-exports at the crate root preserve all existing import paths.
…zers/helpers.rs Extracts all generic deserializer functions (deserialize_optional_string, deserialize_with_default, duration parsers, key-value parsers, etc.) from lib.rs into src/deserializers/helpers.rs. Re-exported at the crate root so all existing import paths continue to work.
Reorganize lib.rs so an engineer opening the file immediately sees the Config struct and its fields, followed by the loading entry points, then the extension trait, builder, and macros. Sections are separated with headers for quick scanning.
9fe85fb to
7c6eb51
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Config<E: ConfigExtension = NoExtension>type that lets consumers define additional configuration fields without modifying or copy-pasting the core crateSourcetype for dual extraction from both env vars and YAML, and amerge_fields!macro to reduce merge boilerplatesrc/layout and adds a README documenting the extension APITest plan
cargo test -p datadog-agent-config)-D warningson lib and testscargo build --workspace)NoExtensionworks, extension receives env/yaml fields, env overrides yaml, defaults when not set, extension does not interfere with core fields