From 85e29a3ae10d04a9e0d643b43c67859dad98a0ad Mon Sep 17 00:00:00 2001 From: nils <48135649+Nilstrieb@users.noreply.github.com> Date: Fri, 25 Feb 2022 15:18:23 +0100 Subject: [PATCH] read config path from env --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 365e0f0..333c4d4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,9 @@ impl EventHandler for Handler { #[tokio::main] async fn main() { - let file = fs::read_to_string("config.json").unwrap(); + let file_path = std::env::var("CONFIG_PATH").unwrap_or("./config.json"); + println!("reading config from {file_path}"); + let file = fs::read_to_string(file_path).unwrap(); let config = serde_json::from_str::(&file).unwrap(); let token = &config.token;