mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-12 00:41:04 +00:00
29 lines
659 B
Rust
29 lines
659 B
Rust
use crate::http_server::web_utils::cookie_manager::CookieManager;
|
|
use crate::http_server::web_utils::session_checker::SessionChecker;
|
|
use sqlx::MySqlPool;
|
|
|
|
/// State that is injected into every endpoint.
|
|
#[derive(Clone)]
|
|
pub struct ServerState {
|
|
/// Configuration from ENV vars.
|
|
pub env_config: EnvConfig,
|
|
|
|
pub hostname: String,
|
|
|
|
pub mysql_pool: MySqlPool,
|
|
|
|
pub cookie_manager: CookieManager,
|
|
|
|
pub session_checker: SessionChecker,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct EnvConfig {
|
|
// Number of thread workers.
|
|
pub num_workers: usize,
|
|
pub bind_address: String,
|
|
pub cookie_domain: String,
|
|
pub cookie_secure: bool,
|
|
pub cookie_http_only: bool,
|
|
}
|