mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-09 03:55:44 +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 = {};
|
users.groups.oauth2-proxy = {};
|
||||||
|
|
||||||
systemd.services.oauth2-proxy = {
|
systemd.services.oauth2-proxy =
|
||||||
description = "OAuth2 Proxy";
|
let needsKeycloak = lib.elem cfg.provider ["keycloak" "keycloak-oidc"]
|
||||||
path = [ cfg.package ];
|
&& config.services.keycloak.enable;
|
||||||
wantedBy = [ "multi-user.target" ];
|
in {
|
||||||
wants = [ "network-online.target" ];
|
description = "OAuth2 Proxy";
|
||||||
after = [ "network-online.target" ];
|
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 = {
|
serviceConfig = {
|
||||||
User = "oauth2-proxy";
|
User = "oauth2-proxy";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
ExecStart = "${cfg.package}/bin/oauth2-proxy ${configString}";
|
ExecStart = "${cfg.package}/bin/oauth2-proxy ${configString}";
|
||||||
EnvironmentFile = lib.mkIf (cfg.keyFile != null) cfg.keyFile;
|
EnvironmentFile = lib.mkIf (cfg.keyFile != null) cfg.keyFile;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue