summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorTristan Daniël Maat <tm@tlater.net>2023-10-07 01:21:21 +0200
committerTristan Daniël Maat <tm@tlater.net>2023-10-07 21:53:02 +0200
commitb59e5a34e782478445b6ea690fd546c8624ed705 (patch)
tree96230718d8142ed250e09659919f8c7cc44d2f13 /nixos/modules/services
parent4d675aec00a1883f872df2a15412d15f2685d758 (diff)
downloadnixpkgs-b59e5a34e782478445b6ea690fd546c8624ed705.tar
nixpkgs-b59e5a34e782478445b6ea690fd546c8624ed705.tar.gz
nixpkgs-b59e5a34e782478445b6ea690fd546c8624ed705.tar.bz2
nixpkgs-b59e5a34e782478445b6ea690fd546c8624ed705.tar.lz
nixpkgs-b59e5a34e782478445b6ea690fd546c8624ed705.tar.xz
nixpkgs-b59e5a34e782478445b6ea690fd546c8624ed705.tar.zst
nixpkgs-b59e5a34e782478445b6ea690fd546c8624ed705.zip
nixos/gitea: Add option to supply the metrics token via file
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/misc/gitea.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index f6ef2bb9191..3f690f85d62 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -246,6 +246,13 @@ in
         description = lib.mdDoc "Path to a file containing the SMTP password.";
       };
 
+      metricsTokenFile = mkOption {
+        type = types.nullOr types.str;
+        default = null;
+        example = "/var/lib/secrets/gitea/metrics_token";
+        description = lib.mdDoc "Path to a file containing the metrics authentication token.";
+      };
+
       settings = mkOption {
         default = {};
         description = lib.mdDoc ''
@@ -433,6 +440,10 @@ in
         PASSWD = "#mailerpass#";
       };
 
+      metrics = mkIf (cfg.metricsTokenFile != null) {
+        TOKEN = "#metricstoken#";
+      };
+
       oauth2 = {
         JWT_SECRET = "#oauth2jwtsecret#";
       };
@@ -559,6 +570,10 @@ in
             ${lib.optionalString (cfg.mailerPasswordFile != null) ''
               ${replaceSecretBin} '#mailerpass#' '${cfg.mailerPasswordFile}' '${runConfig}'
             ''}
+
+            ${lib.optionalString (cfg.metricsTokenFile != null) ''
+              ${replaceSecretBin} '#metricstoken#' '${cfg.metricsTokenFile}' '${runConfig}'
+            ''}
             chmod u-w '${runConfig}'
           }
           (umask 027; gitea_setup)