crud_file_server/
config.rs

1use async_std::path::PathBuf;
2use std::env;
3
4#[derive(Clone)]
5pub struct Config {
6    pub dir_path: PathBuf,
7    pub srv_addr: String,
8}
9
10impl Config {
11    pub fn from_env() -> Self {
12        Self {
13            dir_path: PathBuf::from(env::var("DIRECTORY").unwrap_or("content".into())),
14            srv_addr: env::var("SERVER_ADDR").unwrap_or("0.0.0.0:8000".into()),
15        }
16    }
17}