authelia-nginx: chnaged how to protect websites
This commit is contained in:
parent
7cde74ce97
commit
57a5740f6f
2 changed files with 3 additions and 9 deletions
|
@ -76,12 +76,8 @@ let
|
||||||
error_page 401 =302 https://${config.mine.shared.settings.authelia.domain}/?rd=$target_url;
|
error_page 401 =302 https://${config.mine.shared.settings.authelia.domain}/?rd=$target_url;
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
# TODO: fix this
|
mine.shared.lib.authelia.mkProtectedWebsite = websiteConfig: lib.recursiveUpdate websiteConfig {
|
||||||
mine.shared.lib.authelia.autheliaLocation = autheliaLocation;
|
extraConfig = (lib.attrByPath [ "extraConfig" ] "" websiteConfig) + "\n" + "include ${autheliaLocation};";
|
||||||
|
|
||||||
mine.shared.lib.authelia.mkProtectedWebsite = { vhostConfig, endpoint ? "/" }: lib.recursiveUpdate vhostConfig {
|
|
||||||
extraConfig = (lib.attrByPath [ "extraConfig" ] "" vhostConfig) + "\n" + "include ${autheliaLocation};";
|
|
||||||
locations."${endpoint}" = config.mine.shared.lib.authelia.mkProtectedLocation (lib.attrByPath [ "locations" endpoint ] {} vhostConfig);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mine.shared.lib.authelia.mkProtectedLocation = vhostLocationConfig: lib.recursiveUpdate vhostLocationConfig {
|
mine.shared.lib.authelia.mkProtectedLocation = vhostLocationConfig: lib.recursiveUpdate vhostLocationConfig {
|
||||||
|
|
|
@ -18,9 +18,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts."${config.mine.shared.settings.domain}" = config.mine.shared.lib.authelia.mkProtectedWebsite {
|
services.nginx.virtualHosts."${config.mine.shared.settings.domain}" = config.mine.shared.lib.authelia.mkProtectedWebsite {
|
||||||
endpoint = urlpath;
|
locations."${urlpath}" = config.mine.shared.lib.authelia.mkProtectedLocation {
|
||||||
vhostConfig.locations."${urlpath}" = {
|
|
||||||
# extraConfig = "rewrite ^${urlpath}(.*)$ /$1 break;";
|
|
||||||
proxyPass = "http://localhost:${builtins.toString port}";
|
proxyPass = "http://localhost:${builtins.toString port}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue