Skip to content
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

prefix config attribute is not compatible with config(nest) #4

Open
N4D1K-lgtm opened this issue May 7, 2024 · 0 comments
Open

prefix config attribute is not compatible with config(nest) #4

N4D1K-lgtm opened this issue May 7, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@N4D1K-lgtm
Copy link
Owner

Using #[config(prefix = "your_prefix")] on a field in combination with #[config(nest)] should pass the provided prefix to allow reusing config structs. A simple example:

#[derive(Config, Default)]
struct Nested {
    #[config(prefix = "inner_override")]
    name: String,
    detail: String,
}

#[derive(Config, Default)]
#[config(prefix = "TEST")]
struct NestedTest {
    id: i32,
    #[config(nest, prefix = "NESTED")]
    nested: Nested,
}

This should result in the env variable for Nested.detail to be NESTED_DETAIL

@N4D1K-lgtm N4D1K-lgtm added the enhancement New feature or request label May 7, 2024
@N4D1K-lgtm N4D1K-lgtm self-assigned this May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant