Refactor config to use test_default

Introduced a `test_default` method to `Config` to provide sane defaults
for integration tests. This refactors several test files to use this new
method, reducing boilerplate and improving maintainability.

Added `LLM_TIMEOUT_SECONDS` to the environment variables and `Config`
struct.
This commit is contained in:
2026-04-15 19:07:58 +02:00
parent 872e943da9
commit 5435b60b80
8 changed files with 57 additions and 108 deletions
+1 -18
View File
@@ -14,11 +14,7 @@ fn test_config() -> Arc<Config> {
uuid::Uuid::new_v4()
));
Arc::new(Config {
server_port: 3000,
data_path,
log_level: "info".into(),
log_path: "/tmp/doctate-test/logs".into(),
log_max_days: 90,
users: vec![User {
slug: "dr_test".into(),
api_key: "test-key-123".into(),
@@ -27,20 +23,7 @@ fn test_config() -> Arc<Config> {
whisper: Default::default(),
}],
api_keys: HashMap::from([("test-key-123".into(), "dr_test".into())]),
retention_audio_days: 30,
retention_transcript_days: 30,
retention_document_days: 0,
whisper_url: "http://localhost:10300".into(),
whisper_timeout_seconds: 120,
ollama_url: "http://localhost:11434".into(),
ollama_model: "gemma3:4b".into(),
ollama_keep_alive: 0,
llm_url: String::new(),
llm_api_key: String::new(),
llm_model: String::new(),
llm_temperature: 0.0,
session_timeout_hours: 8,
cookie_secure: false,
..Config::test_default()
})
}