From 14d8afa84498f98cdfbbd44b2c91435aa46a9e86 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 22 Jul 2024 07:12:35 +0100 Subject: [PATCH] WIP --- crates/config/src/tests.rs | 2 +- crates/server-actor/src/handlers/notify_user.rs | 2 +- crates/server-actor/src/lib.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/config/src/tests.rs b/crates/config/src/tests.rs index e69b61e..d9f2df0 100644 --- a/crates/config/src/tests.rs +++ b/crates/config/src/tests.rs @@ -468,7 +468,7 @@ mod server { let http = &server_config.http()?; let http_addr = http.ip(); let http_port = server_config.http()?.port(); - let webhook_url = server_config.webhook().base_url(); + let webhook_url = server_config.inbound_webhook().base_url(); let storage_path = server_config.storage().path(); let notification_webhook_url = server_config .notification() diff --git a/crates/server-actor/src/handlers/notify_user.rs b/crates/server-actor/src/handlers/notify_user.rs index 25e261f..cfb8d6f 100644 --- a/crates/server-actor/src/handlers/notify_user.rs +++ b/crates/server-actor/src/handlers/notify_user.rs @@ -22,7 +22,7 @@ impl Handler for ServerActor { let timestamp = timestamp.unix_timestamp(); let to_sign = format!("{message_id}.{timestamp}.{payload}"); tracing::info!(?to_sign, ""); - let Some(webhook) = notification.webhook() else { + let Some(webhook) = self.webhook.as_ref() else { tracing::warn!("Invalid notification configuration - can't sent notification"); return; }; diff --git a/crates/server-actor/src/lib.rs b/crates/server-actor/src/lib.rs index 2bca343..d55b7df 100644 --- a/crates/server-actor/src/lib.rs +++ b/crates/server-actor/src/lib.rs @@ -14,6 +14,7 @@ use git_next_repo_actor::messages::NotifyUser; use git_next_repo_actor::{messages::CloneRepo, RepoActor}; use git_next_webhook_actor as webhook; use kxio::{fs::FileSystem, network::Network}; +use standardwebhooks::Webhook; use std::{ collections::BTreeMap, path::PathBuf, @@ -53,6 +54,7 @@ pub struct ServerActor { repository_factory: Box, sleep_duration: std::time::Duration, repo_actors: BTreeMap<(ForgeAlias, RepoAlias), Addr>, + webhook: Option, // testing message_log: Option>>>, @@ -78,6 +80,7 @@ impl ServerActor { repository_factory: repo, sleep_duration, repo_actors: BTreeMap::new(), + webhook: None, message_log: None, } }