diff --git a/crates/ptth_relay/src/config.rs b/crates/ptth_relay/src/config.rs index 9ea5d83..e6d1a46 100644 --- a/crates/ptth_relay/src/config.rs +++ b/crates/ptth_relay/src/config.rs @@ -14,11 +14,11 @@ use crate::errors::ConfigError; // set up the HTTP server pub mod file { - use std::collections::HashMap; use serde::Deserialize; #[derive (Deserialize)] pub struct Server { + pub name: String, pub tripcode: String, pub display_name: Option , } @@ -26,7 +26,7 @@ pub mod file { #[derive (Deserialize)] pub struct Config { pub port: Option , - pub servers: HashMap , + pub servers: Vec , } } @@ -62,7 +62,7 @@ impl TryFrom for Config { fn try_from (f: file::Config) -> Result { let servers = f.servers.into_iter () - .map (|(k, v)| Ok::<_, ConfigError> ((k, v.try_into ()?))); + .map (|server| Ok::<_, ConfigError> ((server.name.clone (), server.try_into ()?))); let servers = itertools::process_results (servers, |i| HashMap::from_iter (i))?;