aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs
index 6fc01d8..210a1e6 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,7 +1,6 @@
-use std::{collections::HashMap, fs::read_to_string, net::SocketAddr, path::PathBuf};
-
use anyhow::Context;
use serde::{Deserialize, Serialize};
+use std::{collections::HashMap, fs::read_to_string, net::SocketAddr, path::PathBuf};
#[derive(Debug, Serialize, Deserialize)]
pub struct Config {
@@ -28,8 +27,8 @@ pub struct HostConfig {
}
impl Config {
- pub fn load() -> anyhow::Result<Config> {
- let raw = read_to_string("config.toml").context("reading config file")?;
+ pub fn load(path: &str) -> anyhow::Result<Config> {
+ let raw = read_to_string(path).context("reading config file")?;
let config: Config = toml::from_str(&raw).context("parsing config")?;
Ok(config)
}