This commit is contained in:
2026-04-23 00:07:13 +02:00
parent f073b14e01
commit c36d6b9ded
18 changed files with 609 additions and 14 deletions

View File

@@ -13,6 +13,8 @@ pub struct KbConfig {
pub data: KbDataConfig,
/// Solana endpoint configuration.
pub solana: KbSolanaConfig,
/// Database configuration.
pub database: KbDatabaseConfig,
}
impl KbConfig {
@@ -489,6 +491,36 @@ impl KbWsEndpointConfig {
}
}
/// SQLite configuration.
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct KbSqliteDatabaseConfig {
/// SQLite database path.
pub path: std::string::String,
/// Whether the file should be created if missing.
pub create_if_missing: bool,
/// SQLite busy timeout in milliseconds.
pub busy_timeout_ms: u64,
/// Maximum pool connections.
pub max_connections: u32,
/// Whether the schema should be initialized automatically at startup.
pub auto_initialize_schema: bool,
/// Whether WAL journal mode should be enabled.
pub use_wal: bool,
}
/// Database configuration.
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct KbDatabaseConfig {
/// Whether the database layer is enabled.
pub enabled: bool,
/// Selected backend.
pub backend: crate::KbDatabaseBackend,
/// SQLite-specific configuration.
pub sqlite: KbSqliteDatabaseConfig,
}
fn kb_workspace_root_dir() -> std::path::PathBuf {
let manifest_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
match manifest_dir.parent() {