Add ability to set datapath outside of cli args

This commit is contained in:
Ethan O'Brien
2025-11-30 16:51:08 -06:00
parent 66f97c48ee
commit 60eb7d469b
5 changed files with 30 additions and 23 deletions

View File

@@ -3,7 +3,7 @@ mod options;
mod router;
mod encryption;
mod sql;
mod runtime;
pub mod runtime;
#[macro_use]
mod macros;
@@ -22,9 +22,9 @@ use actix_web::{
web,
dev::Service
};
use std::fs;
use std::time::Duration;
use options::get_args;
pub use options::get_args;
use runtime::get_data_path;
#[actix_web::main]
pub async fn run_server(in_thread: bool) -> std::io::Result<()> {
@@ -78,13 +78,3 @@ pub async fn stop_server() {
runtime::set_running(false);
println!("Stopping");
}
pub fn get_data_path(file_name: &str) -> String {
let args = get_args();
let mut path = args.path;
while path.ends_with('/') {
path.pop();
}
fs::create_dir_all(&path).unwrap();
format!("{}/{}", path, file_name)
}