read config from file whee
parent
9258eeb650
commit
ba66176d9d
|
|
@ -1,6 +1,7 @@
|
|||
use serde::Serialize;
|
||||
use serde::Deserialize;
|
||||
use std::fs;
|
||||
use std::env;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Config {
|
||||
|
|
@ -24,7 +25,11 @@ struct Engine {
|
|||
}
|
||||
|
||||
pub fn build_config() -> Config {
|
||||
return build_config_std()
|
||||
let config_path = env::var("CONFIG_PATH");
|
||||
match config_path {
|
||||
Ok(p) => return build_config_yaml(p),
|
||||
Err(_) => return build_config_std(),
|
||||
}
|
||||
}
|
||||
|
||||
fn build_config_yaml(path: String) -> Config {
|
||||
|
|
|
|||
Loading…
Reference in New Issue