use crate::prelude::*;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DatabaseConfig {
pub db_path: String,
pub db_max_connections: u32,
pub db_connection_timeout_seconds: u64,
pub db_enable_wal: bool,
pub db_enable_foreign_keys: bool,
pub db_busy_timeout_ms: u32,
}
impl Default for DatabaseConfig {
fn default() -> Self {
Self {
db_path: ".wsb/wsb.db".to_string(),
db_max_connections: 10,
db_connection_timeout_seconds: 30,
db_enable_wal: true,
db_enable_foreign_keys: true,
db_busy_timeout_ms: 30000,
}
}
}
impl DatabaseConfig {
pub fn new(db_path: &Path) -> Self {
Self {
db_path: db_path.to_string_lossy().to_string(),
..Default::default()
}
}
}