diff --git a/env/libconductor/src/event_types.rs b/env/libconductor/src/event_types.rs
index 0232912..5e63bdf 100644
--- a/env/libconductor/src/event_types.rs
+++ b/env/libconductor/src/event_types.rs
@@ -14,20 +14,22 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-use libconfig::Config as LibCOnfig;
+use libconfig::Config as LibConfig;
use serde::{Deserialize, Serialize};
-#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone)]
-pub struct NewSite {
- pub path: String,
- pub branch: String,
- pub hostname: String,
-}
-
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone)]
#[serde(untagged)]
pub enum EventType {
- NewSite(NewSite),
- DeleteSite(String),
- Config(LibCOnfig),
+ NewSite {
+ path: String,
+ branch: String,
+ hostname: String,
+ },
+ DeleteSite {
+ hostname: String,
+ },
+
+ Config {
+ data: LibConfig,
+ },
}
diff --git a/src/api/v1/webhook.rs b/src/api/v1/webhook.rs
index 384f3c8..f1c8ffd 100644
--- a/src/api/v1/webhook.rs
+++ b/src/api/v1/webhook.rs
@@ -56,10 +56,8 @@ async fn post_event(ctx: AppCtx, payload: web::Json) -> ServiceResult
#[cfg(test)]
pub mod tests {
- use actix_web::{http::StatusCode, test, App};
- use libconductor::NewSite;
-
use super::*;
+ use actix_web::{http::StatusCode, test, App};
#[actix_rt::test]
async fn submit_works() {
@@ -78,12 +76,11 @@ pub mod tests {
base64::encode(format!("{}:{}", creds.username.clone(), creds.password))
);
- let msg = NewSite {
+ let msg = EventType::NewSite {
hostname: "demo.librepages.org".into(),
branch: "librepages".into(),
path: "/tmp/librepages".into(),
};
- let new_hostname = EventType::NewSite(msg);
// upload json
let upload_json = test::call_service(
@@ -91,7 +88,7 @@ pub mod tests {
test::TestRequest::post()
.append_header((actix_web::http::header::AUTHORIZATION, auth.clone()))
.uri(API_V1_ROUTES.webhook.post_event)
- .set_json(&new_hostname)
+ .set_json(&msg)
.to_request(),
)
.await;