patches on sxsw ai working api key working container hardened plus many more
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
|
||||
use crate::data_model::{Notification, NotificationLevel};
|
||||
use crate::state::StateManager;
|
||||
use crate::webhooks::{self, WebhookEvent};
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
@@ -134,7 +136,7 @@ async fn restart_container(name: &str) -> bool {
|
||||
}
|
||||
|
||||
/// Spawn the health monitor background task.
|
||||
pub fn spawn_health_monitor(state: Arc<StateManager>) {
|
||||
pub fn spawn_health_monitor(state: Arc<StateManager>, data_dir: PathBuf) {
|
||||
tokio::spawn(async move {
|
||||
// Wait 2 minutes for containers to start up
|
||||
tokio::time::sleep(std::time::Duration::from_secs(120)).await;
|
||||
@@ -145,6 +147,14 @@ pub fn spawn_health_monitor(state: Arc<StateManager>) {
|
||||
loop {
|
||||
interval.tick().await;
|
||||
|
||||
// Check webhook config — if webhooks are disabled or ContainerCrash
|
||||
// isn't subscribed, skip all health monitoring (no restarts, no notifications)
|
||||
let webhook_config = webhooks::load_config(&data_dir).await.unwrap_or_default();
|
||||
if !webhook_config.enabled || !webhook_config.events.contains(&WebhookEvent::ContainerCrash) {
|
||||
debug!("Health monitor: skipping — webhooks disabled or ContainerCrash not subscribed");
|
||||
continue;
|
||||
}
|
||||
|
||||
let containers = check_containers().await;
|
||||
if containers.is_empty() {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user