main: use dotenv to load .env
This commit is contained in:
+3
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user