mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
chore(keycloak): change default port
This commit is contained in:
parent
0116ecf47f
commit
5fd4a90dc8
3 changed files with 16 additions and 35 deletions
|
|
@ -3,38 +3,21 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
cfg = config.services.keycloak;
|
||||
inherit (config) networking;
|
||||
inherit (config.services) nginx;
|
||||
access = nginx.access.keycloak;
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = mkDefault access.url;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx.access.keycloak = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
default = "keycloak.local.${networking.domain}";
|
||||
};
|
||||
url = mkOption {
|
||||
type = str;
|
||||
default = "https://${access.host}";
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.keycloak = mkIf cfg.enable {
|
||||
host = mkDefault "localhost";
|
||||
url = mkDefault (if cfg.sslCertificate != null then "https://${access.host}" else "http://${access.host}");
|
||||
};
|
||||
virtualHosts = {
|
||||
keycloak = {
|
||||
name.shortServer = mkDefault "sso";
|
||||
ssl.force = mkDefault true;
|
||||
inherit locations;
|
||||
locations."/".proxyPass = let
|
||||
url = mkDefault (if cfg.sslCertificate != null
|
||||
then "https://localhost:${toString cfg.settings.https-port}"
|
||||
else "http://localhost:${toString cfg.settings.http-port}"
|
||||
);
|
||||
in mkIf cfg.enable (mkDefault url);
|
||||
};
|
||||
keycloak'local = {
|
||||
name.shortServer = mkDefault "sso";
|
||||
|
|
@ -43,14 +26,7 @@ in {
|
|||
cert.copyFromVhost = "keycloak";
|
||||
};
|
||||
local.enable = true;
|
||||
inherit locations;
|
||||
extraConfig = mkIf false ''
|
||||
set $vouch_local_url ${nginx.vouch.localUrl};
|
||||
#if ($x_forwarded_host ~ "\.tail\.${networking.domain}$") {
|
||||
# set $vouch_local_url $x_scheme://${nginx.vouch.tailDomain};
|
||||
#}
|
||||
proxy_redirect ${nginx.vouch.url}/ $vouch_local_url/;
|
||||
'';
|
||||
locations."/".proxyPass = mkDefault nginx.virtualHosts.keycloak.locations."/".proxyPass;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue