mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
nixos/nats: Implemented configuration verification
This commit is contained in:
parent
2789cee804
commit
5ea0207b73
@ -10,6 +10,13 @@ let
|
|||||||
|
|
||||||
configFile = format.generate "nats.conf" cfg.settings;
|
configFile = format.generate "nats.conf" cfg.settings;
|
||||||
|
|
||||||
|
validateConfig = file:
|
||||||
|
pkgs.runCommand "validate-nats-conf" {
|
||||||
|
nativeBuildInputs = [ pkgs.nats-server ];
|
||||||
|
} ''
|
||||||
|
nats-server --config "${configFile}" -t
|
||||||
|
ln -s "${configFile}" "$out"
|
||||||
|
'';
|
||||||
in {
|
in {
|
||||||
|
|
||||||
### Interface
|
### Interface
|
||||||
@ -104,7 +111,7 @@ in {
|
|||||||
})
|
})
|
||||||
{
|
{
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${pkgs.nats-server}/bin/nats-server -c ${configFile}";
|
ExecStart = "${pkgs.nats-server}/bin/nats-server -c ${validateConfig configFile}";
|
||||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
ExecStop = "${pkgs.coreutils}/bin/kill -SIGINT $MAINPID";
|
ExecStop = "${pkgs.coreutils}/bin/kill -SIGINT $MAINPID";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
Loading…
Reference in New Issue
Block a user