Function dotenv_vault::dotenv_override

source ·
pub fn dotenv_override() -> Result<(), Error>
Expand description

Loads all variables into the environment, overriding any existing environment variables of the same name.

If the key or vault cannot be found, a regular .env file is loaded instead.

Where multiple declarations for the same environment variable exist in your .env file, the last one is applied.

If you want the existing environment to take precedence, or if you want to be able to override environment variables on the command line, then use dotenv instead.

§Examples

fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
    dotenv_vault::dotenv_override()?;
    Ok(())
}