Allow passing command line params via environment (fixes #4603)

This commit is contained in:
Felix Ableitner 2024-05-21 12:40:30 +02:00
parent a0ad7806cb
commit cdb4791e66
2 changed files with 6 additions and 6 deletions

View file

@ -165,7 +165,7 @@ urlencoding = "2.1.3"
enum-map = "2.7" enum-map = "2.7"
moka = { version = "0.12.7", features = ["future"] } moka = { version = "0.12.7", features = ["future"] }
i-love-jesus = { version = "0.1.0" } i-love-jesus = { version = "0.1.0" }
clap = { version = "4.5.4", features = ["derive"] } clap = { version = "4.5.4", features = ["derive", "env"] }
pretty_assertions = "1.4.0" pretty_assertions = "1.4.0"
[dependencies] [dependencies]

View file

@ -75,18 +75,18 @@ pub struct CmdArgs {
/// ///
/// If you are running multiple Lemmy server processes, you probably want to disable scheduled tasks on /// If you are running multiple Lemmy server processes, you probably want to disable scheduled tasks on
/// all but one of the processes, to avoid running the tasks more often than intended. /// all but one of the processes, to avoid running the tasks more often than intended.
#[arg(long, default_value_t = false)] #[arg(long, env, default_value_t = false)]
disable_scheduled_tasks: bool, disable_scheduled_tasks: bool,
/// Disables the HTTP server. /// Disables the HTTP server.
/// ///
/// This can be used to run a Lemmy server process that only performs scheduled tasks or activity sending. /// This can be used to run a Lemmy server process that only performs scheduled tasks or activity sending.
#[arg(long, default_value_t = false)] #[arg(long, env, default_value_t = false)]
disable_http_server: bool, disable_http_server: bool,
/// Disable sending outgoing ActivityPub messages. /// Disable sending outgoing ActivityPub messages.
/// ///
/// Only pass this for horizontally scaled setups. /// Only pass this for horizontally scaled setups.
/// See https://join-lemmy.org/docs/administration/horizontal_scaling.html for details. /// See https://join-lemmy.org/docs/administration/horizontal_scaling.html for details.
#[arg(long, default_value_t = false)] #[arg(long, env, default_value_t = false)]
disable_activity_sending: bool, disable_activity_sending: bool,
/// The index of this outgoing federation process. /// The index of this outgoing federation process.
/// ///
@ -96,12 +96,12 @@ pub struct CmdArgs {
/// Make you have exactly one server with each `i` running, otherwise federation will randomly send duplicates or nothing. /// Make you have exactly one server with each `i` running, otherwise federation will randomly send duplicates or nothing.
/// ///
/// See https://join-lemmy.org/docs/administration/horizontal_scaling.html for more detail. /// See https://join-lemmy.org/docs/administration/horizontal_scaling.html for more detail.
#[arg(long, default_value_t = 1)] #[arg(long, env, default_value_t = 1)]
federate_process_index: i32, federate_process_index: i32,
/// How many outgoing federation processes you are starting in total. /// How many outgoing federation processes you are starting in total.
/// ///
/// If set, make sure to set --federate-process-index differently for each. /// If set, make sure to set --federate-process-index differently for each.
#[arg(long, default_value_t = 1)] #[arg(long, env, default_value_t = 1)]
federate_process_count: i32, federate_process_count: i32,
} }