Better handle .env file loading error
Previously it would crash if the file did not exist
This commit is contained in:
@@ -35,7 +35,12 @@ use self::cli::RootCommand;
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
// Load environment variables from .env files
|
||||
dotenv::dotenv()?;
|
||||
if let Err(e) = dotenv::dotenv() {
|
||||
// Display the error if it is something other than the .env file not existing
|
||||
if !e.not_found() {
|
||||
return Err(e).context("could not load .env file");
|
||||
}
|
||||
}
|
||||
|
||||
// Setup logging & tracing
|
||||
let fmt_layer = tracing_subscriber::fmt::layer();
|
||||
|
||||
Reference in New Issue
Block a user