krebs.systemd: don't offer to reload services

Because new credentials won't be available after reloading, only after
restarting.
This commit is contained in:
tv 2021-12-29 16:52:23 +01:00
parent 2f15fd1d68
commit 2280c39d3e

View File

@ -5,18 +5,18 @@
default = {}; default = {};
type = lib.types.attrsOf (lib.types.submodule { type = lib.types.attrsOf (lib.types.submodule {
options = { options = {
ifCredentialsChange = lib.mkOption { restartIfCredentialsChange = lib.mkOption {
default = "restart"; # Enabling this by default only makes sense here as the user already
# bothered to write down krebs.systemd.services.* = {}. If this
# functionality gets upstreamed to systemd.services, restarting
# should be disabled by default.
default = true;
description = '' description = ''
Whether to reload or restart the service whenever any its Whether to restart the service whenever any of its credentials
credentials change. Only credentials with an absolute path in change. Only credentials with an absolute path in LoadCredential=
LoadCredential= are supported. are supported.
''; '';
type = lib.types.enum [ type = lib.types.bool;
"reload"
"restart"
null
];
}; };
}; };
}); });
@ -40,7 +40,7 @@
lib.nameValuePair "trigger-${lib.systemd.encodeName serviceName}" { lib.nameValuePair "trigger-${lib.systemd.encodeName serviceName}" {
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${pkgs.systemd}/bin/systemctl ${cfg.ifCredentialsChange} ${lib.shell.escape serviceName}"; ExecStart = "${pkgs.systemd}/bin/systemctl restart ${lib.shell.escape serviceName}";
}; };
} }
) config.krebs.systemd.services; ) config.krebs.systemd.services;