Compare commits

..

7 commits

Author SHA1 Message Date
61114fe775 WIP
All checks were successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
2024-07-22 10:11:30 +01:00
154c558175 WIP: feat: post webhook to user 2024-07-22 10:11:29 +01:00
3f0d3944d4 WIP: feat: dispatch NotifyUser messages to server actor (2/2) 2024-07-22 10:02:28 +01:00
cc8e482afd refactor: use Option<&T> over &Option<T> 2024-07-22 10:02:26 +01:00
be327d530b WIP: feat: dispatch NotifyUser messages to server actor (1/2) 2024-07-22 10:02:01 +01:00
7d77ef8a84 WIP: feat: support sending messages to a notification webhook 2024-07-22 07:16:34 +01:00
3c0b7096e2 WIP: feat: configure a webhook for receiving notifications 2024-07-22 07:16:29 +01:00

View file

@ -470,11 +470,9 @@ mod server {
let http_port = server_config.http()?.port(); let http_port = server_config.http()?.port();
let webhook_url = server_config.inbound_webhook().base_url(); let webhook_url = server_config.inbound_webhook().base_url();
let storage_path = server_config.storage().path(); let storage_path = server_config.storage().path();
let notification = &server_config.notification(); let notification_webhook_url = server_config
let notification_webhook_url = notification.webhook_url().unwrap_or_default(); .notification()
let notification_webhook_secret = notification .webhook_url()
.webhook_secret()
.map(|secret| secret.expose_secret().clone())
.unwrap_or_default(); .unwrap_or_default();
let forge_alias = server_config let forge_alias = server_config
.forges() .forges()
@ -525,9 +523,9 @@ url = "{webhook_url}"
[storage] [storage]
path = {storage_path:?} path = {storage_path:?}
[notification] [notifications]
type = "Webhook" type = "Webhook"
webhook = {{ url = "{notification_webhook_url}", secret = "{notification_webhook_secret}" }} webhook = {{ url = "{notification_webhook_url}" }}
[forge.{forge_alias}] [forge.{forge_alias}]
forge_type = "{forge_type}" forge_type = "{forge_type}"
@ -747,7 +745,7 @@ mod given {
InboundWebhook::new(a_name()) InboundWebhook::new(a_name())
} }
pub fn an_outbound_webhook() -> OutboundWebhook { pub fn an_outbound_webhook() -> OutboundWebhook {
OutboundWebhook::new(a_name(), a_name()) OutboundWebhook::new(a_name())
} }
pub fn a_server_storage() -> ServerStorage { pub fn a_server_storage() -> ServerStorage {
ServerStorage::new(a_name().into()) ServerStorage::new(a_name().into())