This commit is contained in:
2025-11-02 09:31:01 +01:00
commit 455e144ffb
37 changed files with 4193 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
use libertas_core::error::CoreResult;
use serde::Deserialize;
#[derive(Deserialize, Clone)]
pub enum DatabaseType {
Postgres,
Sqlite,
}
#[derive(Deserialize, Clone)]
pub struct DatabaseConfig {
pub db_type: DatabaseType,
pub url: String,
}
#[derive(Deserialize, Clone)]
pub struct Config {
pub database: DatabaseConfig,
pub server_address: String,
pub jwt_secret: String,
pub media_library_path: String,
}
pub fn load_config() -> CoreResult<Config> {
Ok(Config {
database: DatabaseConfig {
db_type: DatabaseType::Postgres,
url: "postgres://postgres:postgres@localhost:5432/libertas_db".to_string(),
},
server_address: "127.0.0.1:8080".to_string(),
jwt_secret: "super_secret_jwt_key".to_string(),
media_library_path: "media_library".to_string(),
})
}