diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2020-11-12 13:49:00 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2020-11-14 16:33:50 +0100 |
commit | 7534d92648cc4a7c708718e72c21b9483aca385d (patch) | |
tree | 95514138df2e71c288de18eb2e2dcc39a84691a5 /nixos/modules/services/monitoring/telegraf.nix | |
parent | 8edc4619abc884d97583c1ec714c9f7c795fbbac (diff) | |
download | nixpkgs-7534d92648cc4a7c708718e72c21b9483aca385d.tar nixpkgs-7534d92648cc4a7c708718e72c21b9483aca385d.tar.gz nixpkgs-7534d92648cc4a7c708718e72c21b9483aca385d.tar.bz2 nixpkgs-7534d92648cc4a7c708718e72c21b9483aca385d.tar.lz nixpkgs-7534d92648cc4a7c708718e72c21b9483aca385d.tar.xz nixpkgs-7534d92648cc4a7c708718e72c21b9483aca385d.tar.zst nixpkgs-7534d92648cc4a7c708718e72c21b9483aca385d.zip |
nixos/telegraf: allow multiple env files
Diffstat (limited to 'nixos/modules/services/monitoring/telegraf.nix')
-rw-r--r-- | nixos/modules/services/monitoring/telegraf.nix | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nixos/modules/services/monitoring/telegraf.nix b/nixos/modules/services/monitoring/telegraf.nix index 12a360e7229..1fc17ec72da 100644 --- a/nixos/modules/services/monitoring/telegraf.nix +++ b/nixos/modules/services/monitoring/telegraf.nix @@ -20,9 +20,9 @@ in { type = types.package; }; - environmentFile = mkOption { - type = types.nullOr types.path; - default = null; + environmentFiles = mkOption { + type = types.nullOr (types.listOf types.path); + default = []; example = "/run/keys/telegraf.env"; description = '' File to load as environment file. Environment variables @@ -59,7 +59,7 @@ in { ###### implementation config = mkIf config.services.telegraf.enable { systemd.services.telegraf = let - finalConfigFile = if config.services.telegraf.environmentFile == null + finalConfigFile = if config.services.telegraf.environmentFiles == [] then configFile else "/var/run/telegraf/config.toml"; in { @@ -67,8 +67,8 @@ in { wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" ]; serviceConfig = { - EnvironmentFile = config.services.telegraf.environmentFile; - ExecStartPre = lib.optional (config.services.telegraf.environmentFile != null) + EnvironmentFile = config.services.telegraf.environmentFiles; + ExecStartPre = lib.optional (config.services.telegraf.environmentFiles != []) (pkgs.writeShellScript "pre-start" '' umask 077 ${pkgs.envsubst}/bin/envsubst -i "${configFile}" > /var/run/telegraf/config.toml |