blob: d724d6836592c49763f1fe340721ef71272c7521 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
use axum::{Router, routing::get};
use tower_http::trace::TraceLayer;
use crate::{server::routes::health_check, state::AppHandle};
pub mod csrf_token_validation;
pub mod routes;
const CSRF_TOKEN: &str = "csrf_token";
const COOKIE_NAME: &str = "SESSION";
const OAUTH_CSRF_COOKIE: &str = "SESSION";
pub fn router(state: AppHandle) -> Router {
Router::new()
.merge(routes::discord::discord_router(state.clone()))
.route("/", get(health_check))
.route("/auth/authorised", get(health_check))
.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::<Configuration>().unwrap()
}
|