fix config env var

This commit is contained in:
slonkazoid 2024-05-04 00:18:40 +03:00 committed by heavyweaponsgal
parent 514d4e033d
commit e44f4e48b9

View file

@ -139,8 +139,11 @@ impl Default for CacheConfig {
} }
pub async fn load() -> Result<Config> { pub async fn load() -> Result<Config> {
let config_file = env::var(format!("{}_CONFIG", env!("CARGO_BIN_NAME"))) let config_file = env::var(format!(
.unwrap_or(String::from("config.toml")); "{}_CONFIG",
env!("CARGO_BIN_NAME").to_uppercase().replace("-", "_")
))
.unwrap_or(String::from("config.toml"));
match tokio::fs::OpenOptions::new() match tokio::fs::OpenOptions::new()
.read(true) .read(true)
.open(&config_file) .open(&config_file)