pub fn from_filename_override<P: AsRef<Path>>(filename: P) -> Result<PathBuf>
Expand description

Loads environment variables from the specified file, overriding existing environment variables.

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

Examples

dotenvy::from_filename_override("custom.env")?;

It is also possible to load from a typical .env file like so. However, using dotenv_override is preferred.

dotenvy::from_filename_override(".env")?;