chore: Add CONTINUWUITY_ environment variables

Also updates some examples to match
This commit is contained in:
Jade Ellis 2025-05-06 22:56:23 +01:00
parent c0f46269b5
commit 5577ddca27
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2
5 changed files with 34 additions and 14 deletions

View file

@ -1,11 +1,11 @@
[Unit] [Unit]
Description=conduwuit Matrix homeserver
Description=Continuwuity - Matrix homeserver
Wants=network-online.target Wants=network-online.target
After=network-online.target After=network-online.target
Documentation=https://conduwuit.puppyirl.gay/ Documentation=https://continuwuity.org/
RequiresMountsFor=/var/lib/private/conduwuit RequiresMountsFor=/var/lib/private/conduwuit
Alias=matrix-conduwuit.service Alias=matrix-conduwuit.service
[Service] [Service]
DynamicUser=yes DynamicUser=yes
Type=notify-reload Type=notify-reload
@ -59,7 +59,7 @@ StateDirectory=conduwuit
RuntimeDirectory=conduwuit RuntimeDirectory=conduwuit
RuntimeDirectoryMode=0750 RuntimeDirectoryMode=0750
Environment="CONDUWUIT_CONFIG=/etc/conduwuit/conduwuit.toml" Environment="CONTINUWUITY_CONFIG=/etc/conduwuit/conduwuit.toml"
BindPaths=/var/lib/private/conduwuit:/var/lib/matrix-conduit BindPaths=/var/lib/private/conduwuit:/var/lib/matrix-conduit
BindPaths=/var/lib/private/conduwuit:/var/lib/private/matrix-conduit BindPaths=/var/lib/private/conduwuit:/var/lib/private/matrix-conduit

View file

@ -1,9 +1,10 @@
[Unit] [Unit]
Description=conduwuit Matrix homeserver
Description=Continuwuity - Matrix homeserver
Wants=network-online.target Wants=network-online.target
After=network-online.target After=network-online.target
Alias=matrix-conduwuit.service
Documentation=https://continuwuity.org/ Documentation=https://continuwuity.org/
Alias=matrix-conduwuit.service
[Service] [Service]
DynamicUser=yes DynamicUser=yes
@ -11,7 +12,7 @@ User=conduwuit
Group=conduwuit Group=conduwuit
Type=notify Type=notify
Environment="CONDUWUIT_CONFIG=/etc/conduwuit/conduwuit.toml" Environment="CONTINUWUITY_CONFIG=/etc/conduwuit/conduwuit.toml"
ExecStart=/usr/sbin/conduwuit ExecStart=/usr/sbin/conduwuit

View file

@ -75,9 +75,9 @@ dockerTools.buildImage {
else []; else [];
Env = [ Env = [
"CONDUWUIT_TLS__KEY=${./private_key.key}" "CONTINUWUITY_TLS__KEY=${./private_key.key}"
"CONDUWUIT_TLS__CERTS=${./certificate.crt}" "CONTINUWUITY_TLS__CERTS=${./certificate.crt}"
"CONDUWUIT_CONFIG=${./config.toml}" "CONTINUWUITY_CONFIG=${./config.toml}"
"RUST_BACKTRACE=full" "RUST_BACKTRACE=full"
]; ];

View file

@ -1962,7 +1962,11 @@ impl Config {
where where
I: Iterator<Item = &'a Path>, I: Iterator<Item = &'a Path>,
{ {
let envs = [Env::var("CONDUIT_CONFIG"), Env::var("CONDUWUIT_CONFIG")]; let envs = [
Env::var("CONDUIT_CONFIG"),
Env::var("CONDUWUIT_CONFIG"),
Env::var("CONTINUWUITY_CONFIG"),
];
let config = envs let config = envs
.into_iter() .into_iter()
@ -1971,7 +1975,8 @@ impl Config {
.chain(paths.map(Toml::file)) .chain(paths.map(Toml::file))
.fold(Figment::new(), |config, file| config.merge(file.nested())) .fold(Figment::new(), |config, file| config.merge(file.nested()))
.merge(Env::prefixed("CONDUIT_").global().split("__")) .merge(Env::prefixed("CONDUIT_").global().split("__"))
.merge(Env::prefixed("CONDUWUIT_").global().split("__")); .merge(Env::prefixed("CONDUWUIT_").global().split("__"))
.merge(Env::prefixed("CONTINUWUITY_").global().split("__"));
Ok(config) Ok(config)
} }

View file

@ -74,17 +74,30 @@ pub(crate) struct Args {
/// with the exception of the last bucket, try increasing this value to e.g. /// with the exception of the last bucket, try increasing this value to e.g.
/// 50 or 100. Inversely, decrease to 10 etc if the histogram lacks /// 50 or 100. Inversely, decrease to 10 etc if the histogram lacks
/// resolution. /// resolution.
#[arg(long, hide(true), env = "CONDUWUIT_RUNTIME_HISTOGRAM_INTERVAL", default_value = "25")] #[arg(
long,
hide(true),
env = "CONTINUWUITY_RUNTIME_HISTOGRAM_INTERVAL",
env = "CONDUWUIT_RUNTIME_HISTOGRAM_INTERVAL",
default_value = "25"
)]
pub(crate) worker_histogram_interval: u64, pub(crate) worker_histogram_interval: u64,
/// Set the histogram bucket count (tokio_unstable). Default is 20. /// Set the histogram bucket count (tokio_unstable). Default is 20.
#[arg(long, hide(true), env = "CONDUWUIT_RUNTIME_HISTOGRAM_BUCKETS", default_value = "20")] #[arg(
long,
hide(true),
env = "CONTINUWUITY_RUNTIME_HISTOGRAM_BUCKETS",
env = "CONDUWUIT_RUNTIME_HISTOGRAM_BUCKETS",
default_value = "20"
)]
pub(crate) worker_histogram_buckets: usize, pub(crate) worker_histogram_buckets: usize,
/// Toggles worker affinity feature. /// Toggles worker affinity feature.
#[arg( #[arg(
long, long,
hide(true), hide(true),
env = "CONTINUWUITY_RUNTIME_WORKER_AFFINITY",
env = "CONDUWUIT_RUNTIME_WORKER_AFFINITY", env = "CONDUWUIT_RUNTIME_WORKER_AFFINITY",
action = ArgAction::Set, action = ArgAction::Set,
num_args = 0..=1, num_args = 0..=1,
@ -99,6 +112,7 @@ pub(crate) struct Args {
#[arg( #[arg(
long, long,
hide(true), hide(true),
env = "CONTINUWUITY_RUNTIME_GC_ON_PARK",
env = "CONDUWUIT_RUNTIME_GC_ON_PARK", env = "CONDUWUIT_RUNTIME_GC_ON_PARK",
action = ArgAction::Set, action = ArgAction::Set,
num_args = 0..=1, num_args = 0..=1,