diff --git a/.gitignore b/.gitignore index 7c728ef..99e8cdc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ result* brewlog.db TODO.md SPEC.md -backup.json \ No newline at end of file +backup.json +.env \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 503b2a0..3cf5b33 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,9 @@ use tracing_subscriber::{EnvFilter, Registry, layer::SubscriberExt}; #[tokio::main] async fn main() -> Result<()> { + // Load .env file if present (before clap parses env vars) + let _ = dotenvy::dotenv(); + let subscriber = get_subscriber("brewlog".into(), "info".into(), std::io::stdout); init_subscriber(subscriber); @@ -81,6 +84,8 @@ async fn run_server(command: ServeCommand) -> Result<()> { database_url: command.database_url, admin_password: command.admin_password, admin_username: command.admin_username, + openrouter_api_key: command.openrouter_api_key, + openrouter_model: command.openrouter_model, }; serve(config).await