From ba66176d9d47030699ba3bb97e122aa26ae1e137 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Thu, 16 Mar 2023 14:45:55 -0600 Subject: [PATCH] read config from file whee --- src/config.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 6bc13cc..f1c45fc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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 {