Skip to content

Instantly share code, notes, and snippets.

@isaacssemugenyi
Created January 10, 2024 13:17
Show Gist options
  • Save isaacssemugenyi/3552af0da54aaab14c23d2da3517ebde to your computer and use it in GitHub Desktop.
Save isaacssemugenyi/3552af0da54aaab14c23d2da3517ebde to your computer and use it in GitHub Desktop.
// config with dotenv
impl Config {
pub fn from_env() -> Result<Self, ConfigError> {
let s = config::Config::builder()
.add_source(config::Environment::default())
.build()?;
s.try_deserialize()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment