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

Support compile-time defaults #35

Open
rasviitanen opened this issue Nov 23, 2020 · 2 comments
Open

Support compile-time defaults #35

rasviitanen opened this issue Nov 23, 2020 · 2 comments

Comments

@rasviitanen
Copy link

rasviitanen commented Nov 23, 2020

It would be beneficial to be able to use environment variables in defaults via the "env!"-macro.

This would allow you to do something like this:

#[derive(Clone, Debug, Envconfig)]
pub struct Config {
    #[envconfig(
        from = "CUSTOM_LOG_DIR",
        default = env!("DEFAULT_LOG_DIR")
    )]
    pub log_location: String,
}

And get a compilation error "error: environment variable DEFAULT_LOG_DIR not defined" if it isn't accessible.

@KaloyanYosifov
Copy link

Is there any update on this?

@greyblake
Copy link
Owner

@KaloyanYosifov

Hi no, not yet. But if multiple people demand it I will considering adding it.

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

3 participants