config api replace + struct of config changed
parent
60d325e4bf
commit
186674da22
|
|
@ -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
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"api-endpoint" : "http://127.0.0.1:8081/ping",
|
||||
"method" : "GET",
|
||||
"delay" : "5"
|
||||
}
|
||||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue