feat: improved configuration

configuration now works with both env variables and config file
This commit is contained in:
Per Stark
2025-04-09 11:32:23 +02:00
parent 2cafcce9ad
commit b3088b8738
6 changed files with 21 additions and 19 deletions

View File

@@ -35,7 +35,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
db.ensure_initialized().await?;
let session_store = Arc::new(db.create_session_store().await?);
let openai_client = Arc::new(async_openai::Client::new());
let openai_client = Arc::new(async_openai::Client::with_config(
OpenAIConfig::new().with_api_key(&config.openai_api_key),
));
let html_state = HtmlState::new_with_resources(db, openai_client, session_store)?;