update mian.rs and openapi.json
This commit is contained in:
@@ -75,6 +75,22 @@ async fn main() -> AppResult<()> {
|
||||
}
|
||||
});
|
||||
|
||||
// Background task: rotate JWT signing keys every 10 minutes.
|
||||
let token_service = service.internal_auth.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut interval = tokio::time::interval(std::time::Duration::from_secs(600));
|
||||
// Skip the first immediate tick.
|
||||
interval.tick().await;
|
||||
loop {
|
||||
interval.tick().await;
|
||||
match token_service.rotate_if_needed().await {
|
||||
Ok(true) => tracing::info!("signing key rotated"),
|
||||
Ok(false) => tracing::debug!("signing key rotation not needed"),
|
||||
Err(e) => tracing::error!(error = %e, "signing key rotation failed"),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let host = config.get_env_or::<String>("APP_HTTP_HOST", "0.0.0.0".to_string())?;
|
||||
let port = config.get_env_or::<u16>("APP_HTTP_PORT", 8000)?;
|
||||
let workers = config.get_env_or::<usize>(
|
||||
|
||||
Reference in New Issue
Block a user