I'm trying to load env variables from my .env
file with dotenv
pub async fn server() -> Result<(), impl Error> {
//some code
dotenv().ok();
println!("{}", dotenv().unwrap().display());
//some code
}
The .env
file is in my root dir and I already moved it to my src
dir.
called `Result::unwrap()` on an `Err` value: Io(Custom { kind: NotFound, error: "path not found" })
Im trying to load the env variable like this.
let database_url: String = std::env::var("DATABASE_CON").expect("DATABASE_CON must be set.");