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};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct ApiConfig {
|
pub struct ApiConfig {
|
||||||
url : String,
|
#[serde(default)]
|
||||||
method : String,
|
endpoints : Vec<ApiEndpoint>,
|
||||||
delay : u32,
|
delay : u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct ApiEndpoint {
|
||||||
|
url : String,
|
||||||
|
method : String,
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for ApiConfig {
|
impl Default for ApiConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ApiConfig {
|
ApiConfig {
|
||||||
url : String::new(),
|
endpoints : vec![],
|
||||||
method : String::new(),
|
|
||||||
delay : 0,
|
delay : 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue