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 }: 7 let 8 cfg = config.services.vector; 9 - 10 in 11 { 12 options.services.vector = { ··· 31 ''; 32 }; 33 34 settings = lib.mkOption { 35 type = (pkgs.formats.json { }).type; 36 default = { }; ··· 53 let 54 format = pkgs.formats.toml { }; 55 conf = format.generate "vector.toml" cfg.settings; 56 - validateConfig = 57 file: 58 pkgs.runCommand "validate-vector-conf" 59 { ··· 65 ''; 66 in 67 { 68 - ExecStart = "${lib.getExe cfg.package} --config ${validateConfig conf} --graceful-shutdown-limit-secs ${builtins.toString cfg.gracefulShutdownLimitSecs}"; 69 DynamicUser = true; 70 Restart = "always"; 71 StateDirectory = "vector";
··· 6 }: 7 let 8 cfg = config.services.vector; 9 in 10 { 11 options.services.vector = { ··· 30 ''; 31 }; 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 + 41 settings = lib.mkOption { 42 type = (pkgs.formats.json { }).type; 43 default = { }; ··· 60 let 61 format = pkgs.formats.toml { }; 62 conf = format.generate "vector.toml" cfg.settings; 63 + validatedConfig = 64 file: 65 pkgs.runCommand "validate-vector-conf" 66 { ··· 72 ''; 73 in 74 { 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}"; 78 DynamicUser = true; 79 Restart = "always"; 80 StateDirectory = "vector";