diff options
| author | rtkay123 <dev@kanjala.com> | 2026-03-30 17:46:25 +0200 |
|---|---|---|
| committer | rtkay123 <dev@kanjala.com> | 2026-03-30 17:46:25 +0200 |
| commit | cec58d78e968250e4c589899eab460d1132f6d01 (patch) | |
| tree | 53fcd3e1781ebf337a6ce56ca726cd91457e258c /lib/warden-core/src/state/mod.rs | |
| parent | 4071482f983d66b16cc8a5519f5665990dc7bc02 (diff) | |
| download | warden-cec58d78e968250e4c589899eab460d1132f6d01.tar.bz2 warden-cec58d78e968250e4c589899eab460d1132f6d01.zip | |
refactor: generic svcs
Diffstat (limited to 'lib/warden-core/src/state/mod.rs')
| -rw-r--r-- | lib/warden-core/src/state/mod.rs | 28 |
1 files changed, 0 insertions, 28 deletions
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<EnvFilter, tracing_subscriber::Registry>; - -#[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<Self, WardenError> { - 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, - }) - } -} |
