Using .env config
This commit is contained in:
+4
-8
@@ -2,7 +2,6 @@ use std::{
|
||||
collections::HashSet,
|
||||
net::{TcpListener, TcpStream},
|
||||
path::{Path, PathBuf},
|
||||
str::FromStr,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
@@ -52,6 +51,10 @@ impl ServerConfig {
|
||||
pub fn build(self, root: &Path) -> Arc<Server> {
|
||||
Server::new_config(root, self)
|
||||
}
|
||||
|
||||
pub fn from_str(s: &str) -> std::result::Result<Self, serde_json::Error> {
|
||||
serde_json::from_str(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl Server {
|
||||
@@ -207,10 +210,3 @@ impl Server {
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for ServerConfig {
|
||||
type Err = serde_json::Error;
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
serde_json::from_str(s)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user