Unverified Commit 666cb224 authored by Adam C. Stephens's avatar Adam C. Stephens Committed by GitHub
Browse files

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

parents cca17a98 6b4ce1ee
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@
}:
let
  cfg = config.services.vector;

in
{
  options.services.vector = {
@@ -31,6 +30,14 @@ in
      '';
    };

    validateConfig = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Enable the checking of the vector config during build time. This should be disabled when interpolating environment variables.
      '';
    };

    settings = lib.mkOption {
      type = (pkgs.formats.json { }).type;
      default = { };
@@ -53,7 +60,7 @@ in
        let
          format = pkgs.formats.toml { };
          conf = format.generate "vector.toml" cfg.settings;
          validateConfig =
          validatedConfig =
            file:
            pkgs.runCommand "validate-vector-conf"
              {
@@ -65,7 +72,9 @@ in
              '';
        in
        {
          ExecStart = "${lib.getExe cfg.package} --config ${validateConfig conf} --graceful-shutdown-limit-secs ${builtins.toString cfg.gracefulShutdownLimitSecs}";
          ExecStart = "${lib.getExe cfg.package} --config ${
            if cfg.validateConfig then (validatedConfig conf) else conf
          }  --graceful-shutdown-limit-secs ${builtins.toString cfg.gracefulShutdownLimitSecs}";
          DynamicUser = true;
          Restart = "always";
          StateDirectory = "vector";