Fix: Config and CLI arguments are now public

This commit is contained in:
mStar aka a person 2024-01-01 13:33:07 +00:00
parent 4732b00085
commit 9b98d35f26

View file

@ -23,12 +23,12 @@ const CPUS_RESERVED_FOR_SYSTEM: u32 = 2;
#[derive(Debug)]
pub struct Config {
/// Path to the db for diesel to use
database_path: String,
pub database_path: String,
/// Maximum number of workers to use
/// A value of 0 makes stuff single-threaded
max_workers: u32,
pub max_workers: u32,
/// Minimum number of workers to use
min_workers: u32,
pub min_workers: u32,
}
#[derive(Debug, Deserialize)]
@ -53,19 +53,19 @@ struct ConfigToml {
pub struct CLIArguments {
/// Path to the config file
#[arg(default_value = "config.toml")]
config: PathBuf,
pub config: PathBuf,
/// Maximum amount of workers to use.
/// If not set, the max is calculated depending on system resources.
/// A value of 0 will cause the server to be singlethreaded, potentially reducing the performance and responsiveness by a lot
#[arg(long)]
max_workers: Option<u32>,
pub max_workers: Option<u32>,
/// Minimum amount of workers to keep active at all times
/// Can potentially increase reaction speed at the cost of resource usage
#[arg(long)]
min_workers: Option<u32>,
pub min_workers: Option<u32>,
#[arg(long)]
db_path: Option<String>,
pub db_path: Option<String>,
}
pub fn read_from_env() -> Result<Config, Error> {