diff options
Diffstat (limited to 'crates/auth/src/server.rs')
-rw-r--r-- | crates/auth/src/server.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/auth/src/server.rs b/crates/auth/src/server.rs new file mode 100644 index 0000000..3cfac60 --- /dev/null +++ b/crates/auth/src/server.rs @@ -0,0 +1,28 @@ +use axum::{Router, routing::get}; +use tower_http::trace::TraceLayer; + +use crate::{server::routes::health_check, state::AppHandle}; + +pub mod routes; + +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() +} |