diff --git a/config_api.json b/config_api.json new file mode 100644 index 0000000..9136b29 --- /dev/null +++ b/config_api.json @@ -0,0 +1,13 @@ +{ + "endpoints" : [ + { + "url" : "http://127.0.0.1:8081/ping", + "method" : "GET" + }, + { + "url" : "http://127.0.0.1:8081/", + "method" : "GET" + } + ], + "delay" : 5 +} \ No newline at end of file diff --git a/crates/api-grub/config.json b/crates/api-grub/config.json deleted file mode 100644 index f73fd93..0000000 --- a/crates/api-grub/config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "api-endpoint" : "http://127.0.0.1:8081/ping", - "method" : "GET", - "delay" : "5" -} \ No newline at end of file diff --git a/crates/integr-structs/src/api.rs b/crates/integr-structs/src/api.rs index e8c66d3..ec472ba 100644 --- a/crates/integr-structs/src/api.rs +++ b/crates/integr-structs/src/api.rs @@ -1,19 +1,23 @@ use serde::{Serialize, Deserialize}; -#[derive(Serialize, Deserialize)] +#[derive(Serialize, Deserialize, Debug)] pub struct ApiConfig { - url : String, - method : String, + #[serde(default)] + endpoints : Vec, delay : u32, } +#[derive(Serialize, Deserialize, Debug)] +pub struct ApiEndpoint { + url : String, + method : String, +} impl Default for ApiConfig { fn default() -> Self { ApiConfig { - url : String::new(), - method : String::new(), + endpoints : vec![], delay : 0, } }