diff --git a/src/main.rs b/src/main.rs index 82847f7..7a64404 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use core::time::Duration; use std::sync::Arc; -use actix::Actor; +use actix::{Actor, Addr}; use actix_identity::IdentityMiddleware; use actix_identity::config::LogoutBehavior; use actix_remote_ip::RemoteIPConfig; @@ -14,6 +14,7 @@ use actix_web::{App, HttpResponse, HttpServer, get, middleware, web}; use basic_oidc::actors::bruteforce_actor::BruteForceActor; use basic_oidc::actors::openid_sessions_actor::OpenIDSessionsActor; use basic_oidc::actors::providers_states_actor::ProvidersStatesActor; +use basic_oidc::actors::users_actor; use basic_oidc::actors::users_actor::{UsersActor, UsersSyncBackend}; use basic_oidc::constants::*; use basic_oidc::controllers::assets_controller::assets_route; @@ -29,7 +30,17 @@ use basic_oidc::middlewares::auth_middleware::AuthMiddleware; use basic_oidc::middlewares::multi_session_store::MultiSessionStore; #[get("/health")] -async fn health() -> &'static str { +async fn health(users: web::Data>) -> &'static str { + // Check users list is working + let users = users + .send(users_actor::GetAllUsers) + .await + .expect("Could not retrieve users list!"); + if users.is_empty() { + log::error!("Got empty list of users!"); + panic!("Got empty list of users!"); + } + "Running" }