Function dotenvy::dotenv

source ·
pub fn dotenv() -> Result<PathBuf>
Expand description

Loads the .env file from the current directory or parents. This is typically what you want.

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 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

dotenvy::dotenv()?;