pub struct EnvVarSource { /* private fields */ }
Expand description
A config value source that fetches values from environment variables
The source can be supplied with a prefix for environment variables
by using with_prefix
.
Environment variable names, are thus then constructed as
PREFIX_COMPONENT_COMPONENT_COMPONENT
If there is no prefix then it’s just COMPONENT_COMPONENT_COMPONENT
i.e. If the source has a prefix of MYCONFIG
and you requested a value
with the key database::connection_string
. The environment variable
that is looked up would be MYCONFIG_DATABASE_CONNECTION_STRING
It is worth noting, however, that this scheme may cause conflicts as
the key database::connection_string
and database::connection::string
would result in the same environment variable DATABASE_CONNECTION_STRING
.
Implementations§
Source§impl EnvVarSource
impl EnvVarSource
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EnvVarSource
impl RefUnwindSafe for EnvVarSource
impl Send for EnvVarSource
impl Sync for EnvVarSource
impl Unpin for EnvVarSource
impl UnwindSafe for EnvVarSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more