Loads clients list only once (#106)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Currently, the list of client is loaded separately for each Actix HTTP handler threads. In prevision of future improvements, it is worthwhile to load this list only once. Reviewed-on: #106
This commit is contained in:
11
src/main.rs
11
src/main.rs
@ -72,14 +72,15 @@ async fn main() -> std::io::Result<()> {
|
||||
let jwt_signer = JWTSigner::gen_from_memory().expect("Failed to generate JWKS key");
|
||||
let webauthn_manager = Arc::new(WebAuthManager::init(config));
|
||||
|
||||
let mut clients =
|
||||
ClientManager::open_or_create(config.clients_file()).expect("Failed to load clients list!");
|
||||
clients.apply_environment_variables();
|
||||
let clients = Arc::new(clients);
|
||||
|
||||
log::info!("Server will listen on {}", config.listen_address);
|
||||
let listen_address = config.listen_address.to_string();
|
||||
|
||||
HttpServer::new(move || {
|
||||
let mut clients = ClientManager::open_or_create(config.clients_file())
|
||||
.expect("Failed to load clients list!");
|
||||
clients.apply_environment_variables();
|
||||
|
||||
let session_mw = SessionMiddleware::builder(
|
||||
CookieSessionStore::default(),
|
||||
Key::from(config.token_key.as_bytes()),
|
||||
@ -99,7 +100,7 @@ async fn main() -> std::io::Result<()> {
|
||||
.app_data(web::Data::new(users_actor.clone()))
|
||||
.app_data(web::Data::new(bruteforce_actor.clone()))
|
||||
.app_data(web::Data::new(openid_sessions_actor.clone()))
|
||||
.app_data(web::Data::new(clients))
|
||||
.app_data(web::Data::new(clients.clone()))
|
||||
.app_data(web::Data::new(jwt_signer.clone()))
|
||||
.app_data(web::Data::new(webauthn_manager.clone()))
|
||||
.wrap(
|
||||
|
Reference in New Issue
Block a user