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

Automatically detect name for nested structs #41

Open
dorianim opened this issue Oct 5, 2022 · 0 comments
Open

Automatically detect name for nested structs #41

dorianim opened this issue Oct 5, 2022 · 0 comments

Comments

@dorianim
Copy link

dorianim commented Oct 5, 2022

I love this lib, simple and straight forward, thanks!

Just one thing that would be nice to have:
In a case like this:

#[derive(Envconfig, Debug)]
struct ProxyAuthConfig {
    enabled: bool,
    headers_username: Option<String>,
    headers_password: Option<String>,
}

#[derive(Envconfig, Debug)]
struct LocalAuthConfig {
    enabled: bool,
}

#[derive(Envconfig, Debug)]
struct AuthConfig {
    #[envconfig(nested = true)]
    proxy: ProxyAuthConfig,
    #[envconfig(nested = true)]
    local: LocalAuthConfig,
}

#[derive(Envconfig, Debug)]
pub struct ConfigurationService {
    jwt_secret: String,

    #[envconfig(nested = true)]
    auth: AuthConfig,
}

the auth.local.enabled would be named AUTH_LOCAL_ENABLED by default :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant