mod auth_config;
mod password_config;
pub use password_config::{HashConcurrency, PasswordSettings};
mod client_ip;
mod config;
pub use client_ip::{ClientIpResolver, ClientIpSettings, ClientIpStrategy};
mod jobs_config;
mod mail_config;
pub use auth_config::{AuthSettings, AuthThrottleLimit, AuthThrottleSettings, SameSite};
pub use jobs_config::JobsSettings;
pub use mail_config::{MailSecret, MailSettings, SmtpSettings};
mod error;
mod event_error;
mod events;
mod services;
mod storage_config;
pub use event_error::{EventError, EventRejection, EventResult};
pub use events::{Event, EventBus, EventContext, EventFuture, Events};
pub use services::{Service, Services};
pub use storage_config::StorageSettings;
pub use config::{
ApiSettings, AppConfig, AppSettings, DatabaseSettings, HttpSettings, ServerSettings,
};
pub use error::{ApiErrorResponse, AppError, ErrorKind, Result, ValidationErrors};
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct AppContext {
pub config: Arc<AppConfig>,
pub db: sea_orm::DatabaseConnection,
}
#[derive(Clone, Debug)]
pub struct Context(pub AppContext);
impl axum::extract::FromRequestParts<AppContext> for Context {
type Rejection = std::convert::Infallible;
async fn from_request_parts(
_parts: &mut axum::http::request::Parts,
state: &AppContext,
) -> std::result::Result<Self, Self::Rejection> {
Ok(Self(state.clone()))
}
}