nixos/vector: add option to disable the configuration validation (#425119)

authored by Adam C. Stephens and committed by GitHub 666cb224 cca17a98

+12 -3
+12 -3
nixos/modules/services/logging/vector.nix
··· 6 6 }: 7 7 let 8 8 cfg = config.services.vector; 9 - 10 9 in 11 10 { 12 11 options.services.vector = { ··· 31 30 ''; 32 31 }; 33 32 33 + validateConfig = lib.mkOption { 34 + type = lib.types.bool; 35 + default = true; 36 + description = '' 37 + Enable the checking of the vector config during build time. This should be disabled when interpolating environment variables. 38 + ''; 39 + }; 40 + 34 41 settings = lib.mkOption { 35 42 type = (pkgs.formats.json { }).type; 36 43 default = { }; ··· 53 60 let 54 61 format = pkgs.formats.toml { }; 55 62 conf = format.generate "vector.toml" cfg.settings; 56 - validateConfig = 63 + validatedConfig = 57 64 file: 58 65 pkgs.runCommand "validate-vector-conf" 59 66 { ··· 65 72 ''; 66 73 in 67 74 { 68 - ExecStart = "${lib.getExe cfg.package} --config ${validateConfig conf} --graceful-shutdown-limit-secs ${builtins.toString cfg.gracefulShutdownLimitSecs}"; 75 + ExecStart = "${lib.getExe cfg.package} --config ${ 76 + if cfg.validateConfig then (validatedConfig conf) else conf 77 + } --graceful-shutdown-limit-secs ${builtins.toString cfg.gracefulShutdownLimitSecs}"; 69 78 DynamicUser = true; 70 79 Restart = "always"; 71 80 StateDirectory = "vector";