quick fix to be able to set the caches path via env variables like we do for the...
[rapid-gossip-sync-server] / src / config.rs
index 1f968d6418760b880cd1db6862ecf892b9446dc7..bf5a171e4502f015044fef70a75af6c64b94d20c 100644 (file)
@@ -30,8 +30,13 @@ pub(crate) fn network() -> Network {
        }
 }
 
-pub(crate) fn network_graph_cache_path() -> &'static str {
-       "./res/network_graph.bin"
+pub(crate) fn network_graph_cache_path() -> String {
+       format!("{}/network_graph.bin", cache_path())
+}
+
+pub(crate) fn cache_path() -> String {
+       let path = env::var("RAPID_GOSSIP_SYNC_SERVER_CACHES_PATH").unwrap_or("./res".to_string()).to_lowercase();
+       path
 }
 
 pub(crate) fn db_connection_config() -> Config {