config api replace + struct of config changed

pull/3/head
prplV 2025-01-16 14:37:03 +03:00
parent 60d325e4bf
commit 186674da22
3 changed files with 22 additions and 10 deletions

13
config_api.json Normal file
View File

@ -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
}

View File

@ -1,5 +0,0 @@
{
"api-endpoint" : "http://127.0.0.1:8081/ping",
"method" : "GET",
"delay" : "5"
}

View File

@ -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<ApiEndpoint>,
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,
}
}