use axum::{Router, routing::get}; use tower_http::trace::TraceLayer; use crate::{ server::routes::{authorised::login_authorised, health_check}, state::AppHandle, }; pub mod csrf_token_validation; pub mod keys; pub mod grpc; pub mod routes; const CSRF_TOKEN: &str = "csrf_token"; const OAUTH_CSRF_COOKIE: &str = "SESSION"; pub fn router(state: AppHandle) -> Router { Router::new() .route("/auth/authorised", get(login_authorised)) .route("/", get(health_check)) .with_state(state.clone()) .merge(routes::discord::discord_router(state)) .layer(TraceLayer::new_for_http()) } #[cfg(test)] pub(crate) fn test_config() -> stack_up::Configuration { use stack_up::Configuration; let config_path = "auth.toml"; let config = config::Config::builder() .add_source(config::File::new(config_path, config::FileFormat::Toml)) .build() .unwrap(); config.try_deserialize::().unwrap() }