You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
calling .ok on dotenv(), a Result, turns it into a Option. This is not what most people might expect imo. Changing to some error handling might better serve the intention:
fnmain() -> Result<(), dotenvy::Error>{dotenv()?;// or dotenv().unwrap();for(key, value)in env::vars(){println!("{key}: {value}");}}
The text was updated successfully, but these errors were encountered:
The .env file this loads might not be available on the deployed version of a user's app. The environment variables would usually be set elsewhere. By using this pattern no error is thrown if the file isn't found.
As some users may require a .env file, they have the option of using its result type.
You are right: there needs to be better documentation around this issue. It certainly doesn't feel very "rusty" to just .ok() an error like that.
The example in README use
dotenvy::dotenv
feels miss-leading:calling
.ok
on dotenv(), aResult
, turns it into aOption
. This is not what most people might expect imo. Changing to some error handling might better serve the intention:The text was updated successfully, but these errors were encountered: