Fix: Config and CLI arguments are now public
This commit is contained in:
parent
4732b00085
commit
9b98d35f26
1 changed files with 7 additions and 7 deletions
|
@ -23,12 +23,12 @@ const CPUS_RESERVED_FOR_SYSTEM: u32 = 2;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Path to the db for diesel to use
|
/// Path to the db for diesel to use
|
||||||
database_path: String,
|
pub database_path: String,
|
||||||
/// Maximum number of workers to use
|
/// Maximum number of workers to use
|
||||||
/// A value of 0 makes stuff single-threaded
|
/// A value of 0 makes stuff single-threaded
|
||||||
max_workers: u32,
|
pub max_workers: u32,
|
||||||
/// Minimum number of workers to use
|
/// Minimum number of workers to use
|
||||||
min_workers: u32,
|
pub min_workers: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
@ -53,19 +53,19 @@ struct ConfigToml {
|
||||||
pub struct CLIArguments {
|
pub struct CLIArguments {
|
||||||
/// Path to the config file
|
/// Path to the config file
|
||||||
#[arg(default_value = "config.toml")]
|
#[arg(default_value = "config.toml")]
|
||||||
config: PathBuf,
|
pub config: PathBuf,
|
||||||
/// Maximum amount of workers to use.
|
/// Maximum amount of workers to use.
|
||||||
/// If not set, the max is calculated depending on system resources.
|
/// 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
|
/// A value of 0 will cause the server to be singlethreaded, potentially reducing the performance and responsiveness by a lot
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
max_workers: Option<u32>,
|
pub max_workers: Option<u32>,
|
||||||
/// Minimum amount of workers to keep active at all times
|
/// Minimum amount of workers to keep active at all times
|
||||||
/// Can potentially increase reaction speed at the cost of resource usage
|
/// Can potentially increase reaction speed at the cost of resource usage
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
min_workers: Option<u32>,
|
pub min_workers: Option<u32>,
|
||||||
|
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
db_path: Option<String>,
|
pub db_path: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_from_env() -> Result<Config, Error> {
|
pub fn read_from_env() -> Result<Config, Error> {
|
||||||
|
|
Loading…
Reference in a new issue