Skip to content

Commit

Permalink
Add customizing config path
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-ni committed Oct 21, 2024
1 parent 4553ee3 commit ad5079e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ pub fn load(path: &str) -> Result<Config, Error> {
}

pub static CONFIG: LazyLock<Config> = LazyLock::new(|| {
match load("config.json") {
let config_path = var("CONFIG");
let config_path = config_path.as_deref().unwrap_or("config.json");

match load(config_path) {
Ok(config) => config,
Err(err) => {
// Avoid panicking
Expand Down

0 comments on commit ad5079e

Please sign in to comment.