Function dotenvy::from_path

source ·
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<()>
Expand description

Loads environment variables from the specified path.

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 from_path_override instead.

Examples

use std::path::Path;

dotenvy::from_path(Path::new("path/to/.env"))?;