nomilo/src/config.rs

22 lines
439 B
Rust
Raw Normal View History

2021-03-20 02:31:41 +00:00
use std::net::SocketAddr;
use std::path::PathBuf;
use std::fs;
use serde::{Deserialize};
use toml;
#[derive(Deserialize)]
pub struct Config {
pub dns_server: DnsServerConfig
}
#[derive(Deserialize)]
pub struct DnsServerConfig {
pub address: SocketAddr
}
pub fn load(file_name: PathBuf) -> Config {
toml::from_str(&fs::read_to_string(file_name).expect("could not read config file")).expect("could not parse config file")
}