main: use dotenv to load .env

This commit is contained in:
2026-06-08 18:41:47 +02:00
parent 30a4424252
commit b2bfeeec4d
3 changed files with 11 additions and 1 deletions
+3 -1
View File
@@ -587,7 +587,9 @@ async fn main() {
println!("Panic: {}", msg);
}));
if option_env!("OPENAI_API_KEY").is_none() {
dotenv::dotenv().ok();
if std::env::var("OPENAI_API_KEY").is_err() {
eprintln!("Error: OPENAI_API_KEY environment variable not set. The application will not function without it.");
return;
}