mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-08 19:45:42 +03:00
nixos/oauth2_proxy: Conditionally depend on keycloak.service
Co-Authored-By: Jade Lovelace <software@lfcode.ca>
This commit is contained in:
parent
64c94bd40a
commit
b45bb628ea
1 changed files with 15 additions and 13 deletions
|
@ -577,20 +577,22 @@ in
|
|||
|
||||
users.groups.oauth2-proxy = {};
|
||||
|
||||
systemd.services.oauth2-proxy = {
|
||||
description = "OAuth2 Proxy";
|
||||
path = [ cfg.package ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
systemd.services.oauth2-proxy =
|
||||
let needsKeycloak = lib.elem cfg.provider ["keycloak" "keycloak-oidc"]
|
||||
&& config.services.keycloak.enable;
|
||||
in {
|
||||
description = "OAuth2 Proxy";
|
||||
path = [ cfg.package ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ] ++ lib.optionals needsKeycloak [ "keycloak.service" ];
|
||||
after = [ "network-online.target" ] ++ lib.optionals needsKeycloak [ "keycloak.service" ];
|
||||
|
||||
serviceConfig = {
|
||||
User = "oauth2-proxy";
|
||||
Restart = "always";
|
||||
ExecStart = "${cfg.package}/bin/oauth2-proxy ${configString}";
|
||||
EnvironmentFile = lib.mkIf (cfg.keyFile != null) cfg.keyFile;
|
||||
serviceConfig = {
|
||||
User = "oauth2-proxy";
|
||||
Restart = "always";
|
||||
ExecStart = "${cfg.package}/bin/oauth2-proxy ${configString}";
|
||||
EnvironmentFile = lib.mkIf (cfg.keyFile != null) cfg.keyFile;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue