[refactor] removed analytics, config, and modular crates to simplify the codebase and streamline architecture

This commit is contained in:
2025-08-20 16:46:27 +02:00
parent d37daf02f6
commit 57a7b42b9d
41 changed files with 1057 additions and 1450 deletions

View File

@@ -11,11 +11,12 @@ tracing-subscriber = { workspace = true }
axum = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sqlx = { workspace = true }
sqlx = { workspace = true, features = ["sqlite"] }
dotenv = { workspace = true }
once_cell = { workspace = true }
api = { path = "../api" }
db = { path = "../db" }
http = "1.3.1"
[features]

View File

@@ -6,6 +6,7 @@ use tracing_subscriber::EnvFilter;
use api::services::{DefaultHealthService, HealthService};
use api::types::Health;
use api::config::AppSettings;
pub struct AppState {
pub health_service: Arc<dyn HealthService>,
@@ -29,14 +30,18 @@ async fn health_handler(state: Arc<AppState>) -> Json<Health> {
pub async fn start_server(addr: SocketAddr) -> anyhow::Result<()> {
init_tracing();
// TODO: initialize database pools and other infrastructure here.
// let pool = sqlx::PgPool::connect(&db_url).await?;
// Load application settings and initialize the database pool (sqlite).
let app_settings = AppSettings::get_app_settings();
let pool = db::initialize_db(&app_settings).await?;
let state = Arc::new(AppState {
health_service: Arc::new(DefaultHealthService),
});
let app = build_router(state).await;
// Base daemon router
let app = build_router(state).await
// Attach API under /api and provide DB state
.nest("/api", api::api::routes::routes().with_state(pool.clone()));
let listener = TcpListener::bind(addr).await?;
info!("HTTP server listening on http://{}", addr);