Compare commits
9 commits
72e409f952
...
3802ed126f
Author | SHA1 | Date | |
---|---|---|---|
3802ed126f | |||
68cb9d6e41 | |||
d6245ed65e | |||
85ed7aeaa1 | |||
67fc1b1b12 | |||
f6456433b4 | |||
357ad0d713 | |||
e29a2d29b6 | |||
f6bbdf7cce |
1 changed files with 22 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
use actix::prelude::*;
|
||||
use git_next_config::server::NotificationType;
|
||||
use git_next_webhook_actor::{AddWebhookRecipient, ShutdownWebhook, WebhookActor, WebhookRouter};
|
||||
use standardwebhooks::Webhook;
|
||||
|
||||
use crate::{
|
||||
messages::{ReceiveValidServerConfig, ValidServerConfig},
|
||||
|
@ -19,6 +21,26 @@ impl Handler<ReceiveValidServerConfig> for ServerActor {
|
|||
if let Some(webhook_actor_addr) = self.webhook_actor_addr.take() {
|
||||
webhook_actor_addr.do_send(ShutdownWebhook);
|
||||
}
|
||||
match server_config.notification().r#type() {
|
||||
NotificationType::None => { /* do nothing */ }
|
||||
NotificationType::Webhook => {
|
||||
// Create webhook signer
|
||||
use secrecy::ExposeSecret;
|
||||
let webhook = server_config
|
||||
.notification()
|
||||
.webhook_secret()
|
||||
.map(|secret| Webhook::new(secret.expose_secret()))
|
||||
.transpose()
|
||||
.map_err(|e| {
|
||||
tracing::error!(
|
||||
"Invalid notification webhook secret (will not send notifications): {e}"
|
||||
)
|
||||
})
|
||||
.ok()
|
||||
.flatten();
|
||||
self.webhook = webhook;
|
||||
}
|
||||
}
|
||||
self.generation.inc();
|
||||
// Webhook Server
|
||||
tracing::info!("Starting Webhook Server...");
|
||||
|
|
Loading…
Reference in a new issue