read config path from env

This commit is contained in:
nora 2022-02-25 15:18:23 +01:00 committed by GitHub
parent ea2ae4ddcb
commit 85e29a3ae1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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::<ConfigFile>(&file).unwrap();
let token = &config.token;