mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-02-27 22:13:12 -08:00
chore(tests): Make the services in the integration tests only start once they are needed
This commit is contained in:
@@ -14,7 +14,13 @@ let
|
||||
{
|
||||
# Each instance of ths service is defined by the following information:
|
||||
options = {
|
||||
enable = lib.mkEnableOption "RP Keysync for ${name}";
|
||||
create = lib.mkEnableOption "RP Keysync for ${name}";
|
||||
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Should the service be enabled";
|
||||
default = true;
|
||||
};
|
||||
|
||||
wgInterface = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
@@ -52,7 +58,7 @@ in
|
||||
name = "${servicePrefix}${instanceName}";
|
||||
value = {
|
||||
description = "Rosenpass Key Downloader ${instanceName}";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wantedBy = [ ] ++ lib.optional instanceCfg.enable "multi-user.target"; # If we set enable to this, then the service will be masked and cannot be enabled. Doing it this way allows us to enable it.
|
||||
requires = [ "network-online.target" ];
|
||||
# The script downloads the key generated by rosenpass from the key exchange node and sets it as the preshared key for the specified wireguard peer.
|
||||
script = ''
|
||||
@@ -68,7 +74,7 @@ in
|
||||
RestartSec = 10;
|
||||
};
|
||||
};
|
||||
}) (lib.filterAttrs (_: cfg: cfg.enable) cfg.instances); # this creates one systemd service (as above) per configured instance.
|
||||
}) (lib.filterAttrs (_: cfg: cfg.create) cfg.instances); # this creates one systemd service (as above) per configured instance.
|
||||
|
||||
systemd.timers = lib.mapAttrs' (instanceName: instanceCfg: {
|
||||
name = "${timerPrefix}${instanceName}";
|
||||
@@ -80,6 +86,6 @@ in
|
||||
Unit = "${servicePrefix}${instanceName}.service";
|
||||
};
|
||||
};
|
||||
}) (lib.filterAttrs (_: cfg: cfg.enable) cfg.instances); # this creates one systemd time (as above) per configured instance.
|
||||
}) (lib.filterAttrs (_: cfg: cfg.create) cfg.instances); # this creates one systemd timer (as above) per configured instance.
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user