From cec58d78e968250e4c589899eab460d1132f6d01 Mon Sep 17 00:00:00 2001 From: rtkay123 Date: Mon, 30 Mar 2026 17:46:25 +0200 Subject: refactor: generic svcs --- lib/warden-core/src/state/mod.rs | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 lib/warden-core/src/state/mod.rs (limited to 'lib/warden-core/src/state/mod.rs') diff --git a/lib/warden-core/src/state/mod.rs b/lib/warden-core/src/state/mod.rs deleted file mode 100644 index 18e44b8..0000000 --- a/lib/warden-core/src/state/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -pub(crate) mod database; -use sqlx::PgPool; -use tracing::{debug, trace}; -use tracing_subscriber::EnvFilter; - -use crate::{WardenError, config::Configuration}; - -pub type LogHandle = tracing_subscriber::reload::Handle; - -#[derive(Debug, Clone)] -pub struct AppState { - pub log_handle: LogHandle, - pub database: PgPool, -} - -impl AppState { - pub async fn new(log_handle: LogHandle, config: &Configuration) -> Result { - let database = database::connect(&config.database).await?; - trace!("running database migrations"); - sqlx::migrate!("../../migrations").run(&database).await?; - debug!("database up to date"); - - Ok(Self { - log_handle, - database, - }) - } -} -- cgit v1.2.3