Function dotenv::var

source · []
pub fn var<K: AsRef<OsStr>>(key: K) -> Result<String>
Expand description

Load the .env file and fetch the environment variable key from the current process.

For more details, please visit load or std::env::var.

NOTE

  • The .env file will be loaded once, so it’s cheap to call var again and again.
  • The error occurs in loading the .env file will be ignored.

Examples

let var = dotenv::var("FOO").unwrap();