Support compile-time defaults
rasviitanen opened this issue · 2 comments
rasviitanen commented
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 commented
Is there any update on this?
greyblake commented
Hi no, not yet. But if multiple people demand it I will considering adding it.