feat: backend MVP (auth/rbac, catalog, orders, fulfillment, invoices) + specs + scaffolds
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
use sqlx::PgPool;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub db: PgPool,
|
||||
pub redis: redis::aio::ConnectionManager,
|
||||
pub config: crate::config::Config,
|
||||
}
|
||||
|
||||
pub async fn build_state(config: &crate::config::Config) -> anyhow::Result<AppState> {
|
||||
let db = PgPool::connect(&config.database_url).await?;
|
||||
let client = redis::Client::open(config.redis_url.clone())?;
|
||||
let redis = redis::aio::ConnectionManager::new(client).await?;
|
||||
Ok(AppState {
|
||||
db,
|
||||
redis,
|
||||
config: config.clone(),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user