Compare commits

..

7 commits

Author SHA1 Message Date
be924ba9c1 WIP
All checks were successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
2024-07-22 10:21:22 +01:00
911525933b WIP: feat: post webhook to user 2024-07-22 10:20:58 +01:00
b061594556 WIP: feat: dispatch NotifyUser messages to server actor (2/2) 2024-07-22 10:20:51 +01:00
a8d9b5536e refactor: use Option<&T> over &Option<T> 2024-07-22 10:20:47 +01:00
d03ec7036d WIP: feat: dispatch NotifyUser messages to server actor (1/2) 2024-07-22 10:20:42 +01:00
3644ce33b3 WIP: feat: support sending messages to a notification webhook 2024-07-22 10:20:39 +01:00
a47ba6c289 WIP: feat: configure a webhook for receiving notifications 2024-07-22 10:20:31 +01:00

View file

@ -470,9 +470,11 @@ 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_webhook_url = server_config let notification = &server_config.notification();
.notification() let notification_webhook_url = notification.webhook_url().unwrap_or_default();
.webhook_url() let notification_webhook_secret = notification
.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()
@ -523,9 +525,9 @@ url = "{webhook_url}"
[storage] [storage]
path = {storage_path:?} path = {storage_path:?}
[notifications] [notification]
type = "Webhook" type = "Webhook"
webhook = {{ url = "{notification_webhook_url}" }} webhook = {{ url = "{notification_webhook_url}", secret = "{notification_webhook_secret}" }}
[forge.{forge_alias}] [forge.{forge_alias}]
forge_type = "{forge_type}" forge_type = "{forge_type}"
@ -745,7 +747,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()) OutboundWebhook::new(a_name(), a_name())
} }
pub fn a_server_storage() -> ServerStorage { pub fn a_server_storage() -> ServerStorage {
ServerStorage::new(a_name().into()) ServerStorage::new(a_name().into())