dotenv

Function dotenv 

Source
pub fn dotenv() -> Result<(), Error>
Expand description

Loads the .env.vault file from env::current_dir using the DOTENV_KEY environment variable.

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

If variables with the same names already exist in the environment, then their values will be preserved.

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

If you wish to ensure all variables are loaded from your .env.vault file, ignoring variables already existing in the environment, then use dotenv_override instead.

An error will be returned if the file is not found.

ยงExamples

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