rewrite in rust

This commit is contained in:
Infendro committed 2026-08-29 14:36:14 +02:00
1 parent aa7f37500f
commit 540d990aeb
35 files changed
+1949 -1557

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
use serde::Deserialize;
use std::{error::Error, fs};
#[derive(Deserialize)]
pub struct Config {
#[serde(flatten)]
pub auth: Auth,
pub entries: Vec<Entry>,
}
#[derive(Deserialize)]
pub struct Auth {
pub key: String,
pub secret_key: String,
}
#[derive(Deserialize)]
pub struct Entry {
pub domain: String,
pub subdomains: Vec<String>,
}
pub fn load(path: &str) -> Result<Config, Box<dyn Error>> {
let raw = fs::read_to_string(&path)?;
let config = serde_json::from_str(&raw)?;
Ok(config)
}