readiness follows a cached store check instead of a constant or a login per probe
This commit is contained in:
parent
2eacb83b21
commit
b0239914b8
1 changed files with 369 additions and 40 deletions
|
|
@ -125,11 +125,16 @@ async fn main() -> Result<()> {
|
|||
|
||||
let app = Router::new()
|
||||
.route("/requests", post(handle_request))
|
||||
.with_state(state);
|
||||
.with_state(Arc::clone(&state));
|
||||
|
||||
let listener = bind_socket(&socket)?;
|
||||
tracing::info!(socket = %socket.display(), "swarm-authelia-bridge listening");
|
||||
health.ready_when(|| true);
|
||||
// Ready means the users file loads: without it every request fails.
|
||||
let users_file = state.config.users_file.clone();
|
||||
health.ready_while_checked(move || {
|
||||
let users_file = users_file.clone();
|
||||
async move { store::load_store(&users_file).map(drop) }
|
||||
});
|
||||
serve(listener, app, stop).await
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue