feat: update dependencies and enhance configuration loading for CORS support
This commit is contained in:
@@ -5,6 +5,8 @@ use crate::SqliteUserRepository;
|
||||
use crate::db::DatabasePool;
|
||||
use domain::UserRepository;
|
||||
|
||||
use k_core::session::store::InfraSessionStore;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum FactoryError {
|
||||
#[error("Database error: {0}")]
|
||||
@@ -35,20 +37,14 @@ pub async fn build_user_repository(pool: &DatabasePool) -> FactoryResult<Arc<dyn
|
||||
pub async fn build_session_store(
|
||||
pool: &DatabasePool,
|
||||
) -> FactoryResult<crate::session_store::InfraSessionStore> {
|
||||
match pool {
|
||||
Ok(match pool {
|
||||
#[cfg(feature = "sqlite")]
|
||||
DatabasePool::Sqlite(pool) => {
|
||||
let store = tower_sessions_sqlx_store::SqliteStore::new(pool.clone());
|
||||
Ok(crate::session_store::InfraSessionStore::Sqlite(store))
|
||||
DatabasePool::Sqlite(p) => {
|
||||
InfraSessionStore::Sqlite(tower_sessions_sqlx_store::SqliteStore::new(p.clone()))
|
||||
}
|
||||
#[cfg(feature = "postgres")]
|
||||
DatabasePool::Postgres(pool) => {
|
||||
let store = tower_sessions_sqlx_store::PostgresStore::new(pool.clone());
|
||||
Ok(crate::session_store::InfraSessionStore::Postgres(store))
|
||||
DatabasePool::Postgres(p) => {
|
||||
InfraSessionStore::Postgres(tower_sessions_sqlx_store::PostgresStore::new(p.clone()))
|
||||
}
|
||||
#[allow(unreachable_patterns)]
|
||||
_ => Err(FactoryError::NotImplemented(
|
||||
"No database feature enabled".to_string(),
|
||||
)),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user