Function dotenvy::from_filename
source · pub fn from_filename<P: AsRef<Path>>(filename: P) -> Result<PathBuf>
Expand description
Loads environment variables from the specified file.
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_filename_override
instead.
Examples
dotenvy::from_filename("custom.env")?;
It is also possible to load from a typical .env file like so. However, using dotenv
is preferred.
dotenvy::from_filename(".env")?;