From 9a92a8047e2600e5e5ba8d15b0e6783424cca151 Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Thu, 6 Jun 2024 21:47:03 -0700 Subject: [PATCH] drop support for environment variables The configuration file is now the canonical way to, well, configure. This change is desirable because it gives us much more flexibility with how configuration is structured. Environment variables are insufficient because, for example, they're a flat namespace and have no built-in way to represent lists. --- nix/modules/default/default.nix | 10 ---------- src/main.rs | 6 ++---- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/nix/modules/default/default.nix b/nix/modules/default/default.nix index aed8b1b7..91eba6d9 100644 --- a/nix/modules/default/default.nix +++ b/nix/modules/default/default.nix @@ -25,15 +25,6 @@ in pkgsText = "inputs.grapevine.packages.\${pkgs.system}"; }; - extraEnvironment = lib.mkOption { - type = types.attrsOf types.str; - description = '' - Extra environment variables to set for the process. - ''; - default = {}; - example = { RUST_BACKTRACE="yes"; }; - }; - settings = lib.mkOption { type = types.submodule { freeformType = format.type; @@ -85,7 +76,6 @@ in systemd.services.grapevine = { description = "Grapevine (Matrix homeserver)"; wantedBy = [ "multi-user.target" ]; - environment = cfg.extraEnvironment; # Keep sorted serviceConfig = { diff --git a/src/main.rs b/src/main.rs index bc390f3c..4a661b7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ use axum_server::{ bind, bind_rustls, tls_rustls::RustlsConfig, Handle as ServerHandle, }; use figment::{ - providers::{Env, Format, Toml}, + providers::{Format, Toml}, Figment, }; use http::{ @@ -111,9 +111,7 @@ async fn try_main() -> Result<(), error::Main> { let args = args::parse(); // Initialize config - let raw_config = Figment::new() - .merge(Toml::file(&args.config).nested()) - .merge(Env::prefixed("GRAPEVINE_").global()); + let raw_config = Figment::new().merge(Toml::file(&args.config).nested()); let config = raw_config.extract::()?;