victoriametrics & vmagent: Make the config check optional
This follows the pattern that AlertManager uses. Currently if you use environment variables, the config check will fail.
This commit is contained in:
@@ -24,10 +24,13 @@ let
|
||||
|
||||
checkedConfig =
|
||||
file:
|
||||
pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } ''
|
||||
ln -s ${file} $out
|
||||
${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun
|
||||
'';
|
||||
if cfg.checkConfig then
|
||||
pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } ''
|
||||
ln -s ${file} $out
|
||||
${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun
|
||||
''
|
||||
else
|
||||
file;
|
||||
in
|
||||
{
|
||||
options.services.victoriametrics = {
|
||||
@@ -127,6 +130,17 @@ in
|
||||
or {command}`victoriametrics -help` for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
checkConfig = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Check configuration.
|
||||
|
||||
If you use credentials stored in external files (`environmentFile`, etc),
|
||||
they will not be visible and it will report errors, despite a correct configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
@@ -30,10 +30,13 @@ let
|
||||
|
||||
checkedConfig =
|
||||
file:
|
||||
pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } ''
|
||||
ln -s ${file} $out
|
||||
${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun
|
||||
'';
|
||||
if cfg.checkConfig then
|
||||
pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } ''
|
||||
ln -s ${file} $out
|
||||
${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun
|
||||
''
|
||||
else
|
||||
file;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -119,6 +122,17 @@ in
|
||||
or {command}`vmagent -help` for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
checkConfig = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Check configuration.
|
||||
|
||||
If you use credentials stored in external files (`environmentFile`, etc),
|
||||
they will not be visible and it will report errors, despite a correct configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
Reference in New Issue
Block a user