From f7155b7372f9007a378cb07d5acdc1abcc8cc7f1 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Tue, 29 Nov 2022 10:59:06 -0500 Subject: fs: parameterize remote references --- src/bot.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/bot.rs') diff --git a/src/bot.rs b/src/bot.rs index 23e67c1..f74d581 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -1,7 +1,7 @@ use std::{ sync::Mutex, fs::File, - result::Result as StdResult, + result::Result as StdResult, path::PathBuf, str::FromStr, }; use serenity::{ @@ -97,7 +97,10 @@ lazy_static! { }; static ref RESTRICT_IDS: FnvHashSet = { - let restrict_ids = File::open("restrict.json") + let default_path = PathBuf::from_str("restrict.json").unwrap(); + let restrict_path = CONFIG.restrict.as_ref().unwrap_or(&default_path); + + let restrict_ids = File::open(restrict_path) .map_err(Error::from) .and_then(|f| serde_json::from_reader::<_, Vec>(f).map_err(Error::from)); -- cgit v1.3.1