(
State(mut state): State<SigningState>,
)
| 361 | } |
| 362 | |
| 363 | async fn handle_reload( |
| 364 | State(mut state): State<SigningState>, |
| 365 | ) -> Result<impl IntoResponse, SignerModuleError> { |
| 366 | let req_id = Uuid::new_v4(); |
| 367 | |
| 368 | debug!(event = "reload", ?req_id, "New request"); |
| 369 | |
| 370 | let config = match StartSignerConfig::load_from_env() { |
| 371 | Ok(config) => config, |
| 372 | Err(err) => { |
| 373 | error!(event = "reload", ?req_id, error = ?err, "Failed to reload config"); |
| 374 | return Err(SignerModuleError::Internal("failed to reload config".to_string())); |
| 375 | } |
| 376 | }; |
| 377 | |
| 378 | let new_manager = match start_manager(config).await { |
| 379 | Ok(manager) => manager, |
| 380 | Err(err) => { |
| 381 | error!(event = "reload", ?req_id, error = ?err, "Failed to reload manager"); |
| 382 | return Err(SignerModuleError::Internal("failed to reload config".to_string())); |
| 383 | } |
| 384 | }; |
| 385 | |
| 386 | state.manager = Arc::new(RwLock::new(new_manager)); |
| 387 | |
| 388 | Ok(StatusCode::OK) |
| 389 | } |
| 390 | |
| 391 | async fn start_manager(config: StartSignerConfig) -> eyre::Result<SigningManager> { |
| 392 | let proxy_store = if let Some(store) = config.store.clone() { |
nothing calls this directly
no test coverage detected