Url to path doesn't work for dir list

This commit is contained in:
int 80h
2020-04-21 19:40:57 -04:00
parent ef003c3eee
commit 4056cbbc2f
3 changed files with 116 additions and 81 deletions

View File

@@ -1,22 +1,21 @@
extern crate serde_derive;
extern crate toml;
use toml::de::Error;
use std::collections::HashMap;
use toml::de::Error;
// use serde_derive::Deserialize;
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, Clone)]
pub struct Config {
pub port: i32,
pub host: String,
pub server: Vec<Server>,
}
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, Clone)]
pub struct Server {
pub url: String,
pub dir: String,
pub key: String,
pub dir: String,
pub key: String,
pub cert: String,
}
@@ -26,13 +25,11 @@ impl Config {
let config: Config = toml::from_str(&fd).unwrap();
return config;
}
pub fn to_map( &self /*cfg: &config::Config*/) -> HashMap<String, String> {
pub fn to_map(&self /*cfg: &config::Config*/) -> HashMap<String, String> {
let mut map = HashMap::new();
for srv in &self.server {
map.insert(srv.url.clone(), srv.dir.clone());
}
map
}
}