change config format to toml
This commit is contained in:
4 files changed
+58
-3
No files matched your search
+1
-2
@@ -3,7 +3,6 @@ use std::{error::Error, fs};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Config {
|
||||
#[serde(flatten)]
|
||||
pub auth: Auth,
|
||||
pub entries: Vec<Entry>,
|
||||
}
|
||||
@@ -22,6 +21,6 @@ pub struct Entry {
|
||||
|
||||
pub fn load(path: &str) -> Result<Config, Box<dyn Error>> {
|
||||
let raw = fs::read_to_string(&path)?;
|
||||
let config = serde_json::from_str(&raw)?;
|
||||
let config = toml::from_str(&raw)?;
|
||||
Ok(config)
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ mod config;
|
||||
mod dns;
|
||||
mod ip;
|
||||
|
||||
const CONFIG: &str = "/etc/ddns.json";
|
||||
const CONFIG: &str = "/etc/ddns.conf";
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
Reference in new issue
Block a user