From cdb4791e66ec01f49f38defa711a2aa0f11e54df Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 21 May 2024 12:40:30 +0200 Subject: [PATCH] Allow passing command line params via environment (fixes #4603) --- Cargo.toml | 2 +- src/lib.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bbdce4a75..cc8c347ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -165,7 +165,7 @@ urlencoding = "2.1.3" enum-map = "2.7" moka = { version = "0.12.7", features = ["future"] } 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" [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 61e8abd13..b3401d1e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,18 +75,18 @@ pub struct CmdArgs { /// /// 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. - #[arg(long, default_value_t = false)] + #[arg(long, env, default_value_t = false)] disable_scheduled_tasks: bool, /// Disables the HTTP server. /// /// 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 sending outgoing ActivityPub messages. /// /// Only pass this for horizontally scaled setups. /// 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, /// 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. /// /// 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, /// How many outgoing federation processes you are starting in total. /// /// 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, }