💥 Break relay config again
parent
14df0bdf92
commit
e59bb5b7bc
|
@ -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 <String>,
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ pub mod file {
|
|||
#[derive (Deserialize)]
|
||||
pub struct Config {
|
||||
pub port: Option <u16>,
|
||||
pub servers: HashMap <String, Server>,
|
||||
pub servers: Vec <Server>,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ impl TryFrom <file::Config> for Config {
|
|||
|
||||
fn try_from (f: file::Config) -> Result <Self, Self::Error> {
|
||||
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))?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue