diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2022-11-25 11:32:43 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2022-11-25 11:32:43 -0500 |
commit | f4713b1ccf508c0ec1192ce8d800f21111e655e1 (patch) | |
tree | 25d5641b006af4533c2a25e762526428dc397a85 /server/src/main.rs | |
parent | 24c71b3ddbcd793e533ee518bc1f82b1b5fa3d9e (diff) |
Extract authenticator logic into a trait
This is in preparation for providing a fake authenticator backend
Diffstat (limited to 'server/src/main.rs')
-rw-r--r-- | server/src/main.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/src/main.rs b/server/src/main.rs index 130506c..2363110 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -13,14 +13,14 @@ use protocol::{bridge_engine::{self, TableView, Player}, Table, UserInfo}; use server::ContextExtension; use tower_cookies::{Cookie, CookieManagerLayer, Cookies}; use tower_http::trace::TraceLayer; -use tracing::info; +use tracing::{info, log::warn}; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; mod auth; mod error; mod play; mod server; use crate::{ - auth::{Authenticator, SessionId}, + auth::{OauthAuthenticator, SessionId}, server::ServerContext, }; use crate::{ @@ -61,9 +61,12 @@ async fn main() { let app_url = env::var("APP_URL").unwrap(); + #[cfg(debug_assertions)] + warn!("Running a debug build."); + let state = Arc::new(ServerContext { app_url, - authenticator: Authenticator::from_env(db_pool.clone()).await, + authenticator: Box::new(OauthAuthenticator::from_env(db_pool.clone()).await), db: db_pool, }); |