Compare commits

..

1 commit

Author SHA1 Message Date
346920cde5 WIP: feat: configure a webhook for receiving notifications
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-19 07:37:24 +01:00
5 changed files with 12 additions and 22 deletions

View file

@ -7,7 +7,6 @@ repository = { workspace = true }
description = "webhook actor for git-next, the trunk-based development manager" description = "webhook actor for git-next, the trunk-based development manager"
[dependencies] [dependencies]
git-next-actor-macros = { workspace = true }
git-next-config = { workspace = true } git-next-config = { workspace = true }
git-next-repo-actor = { workspace = true } git-next-repo-actor = { workspace = true }

View file

@ -1 +0,0 @@
mod shutdown_webhook;

View file

@ -1,13 +0,0 @@
//
use actix::prelude::*;
use crate::{ShutdownWebhook, WebhookActor};
impl Handler<ShutdownWebhook> for WebhookActor {
type Result = ();
fn handle(&mut self, _msg: ShutdownWebhook, ctx: &mut Self::Context) -> Self::Result {
self.spawn_handle.take();
ctx.stop();
}
}

View file

@ -1,13 +1,10 @@
// //
use actix::prelude::*; use actix::prelude::*;
mod handlers;
pub mod messages;
mod router; mod router;
mod server; mod server;
use git_next_repo_actor::messages::WebhookNotification; use git_next_repo_actor::messages::WebhookNotification;
pub use messages::ShutdownWebhook;
use std::net::SocketAddr; use std::net::SocketAddr;
@ -43,3 +40,15 @@ impl Actor for WebhookActor {
self.spawn_handle.replace(spawn_handle); self.spawn_handle.replace(spawn_handle);
} }
} }
#[derive(Debug, Message)]
#[rtype(result = "()")]
pub struct ShutdownWebhook;
impl Handler<ShutdownWebhook> for WebhookActor {
type Result = ();
fn handle(&mut self, _msg: ShutdownWebhook, ctx: &mut Self::Context) -> Self::Result {
self.spawn_handle.take();
ctx.stop();
}
}

View file

@ -1,4 +0,0 @@
//
use git_next_actor_macros::message;
message!(ShutdownWebhook: "Request to shutdown the Webhook actor");