updated member app and authelia nginx

This commit is contained in:
eyjhb 2024-08-13 14:41:47 +02:00
parent 23faf44b39
commit 74ff08576a
No known key found for this signature in database
GPG key ID: 609F508E3239F920
3 changed files with 9 additions and 21 deletions

View file

@ -76,22 +76,8 @@ let
error_page 401 =302 https://auth.fricloud.dk/?rd=$target_url; error_page 401 =302 https://auth.fricloud.dk/?rd=$target_url;
''; '';
in { in {
mine.shared.lib.authelia.mkProtectedWebsite = { vhostConfig, endpoint ? "/" }: lib.recursiveUpdate { mine.shared.lib.authelia.mkProtectedWebsite = { vhostConfig, endpoint ? "/" }: lib.recursiveUpdate vhostConfig {
forceSSL = true; extraConfig = (lib.attrByPath [ "extraConfig" ] "" vhostConfig) + "\n" + "include ${autheliaLocation};";
enableACME = true; locations."${endpoint}".extraConfig = (lib.attrByPath [ "locations" endpoint "extraConfig" ] "" vhostConfig) + "\n" + "include ${autheliaRequest};";
extraConfig = "include ${autheliaLocation};";
locations."${endpoint}" = {
extraConfig = "include ${autheliaRequest};";
};
} vhostConfig;
services.nginx.virtualHosts."test.fricloud.dk" = config.mine.shared.lib.authelia.mkProtectedWebsite {
vhostConfig = {
locations."/".root = pkgs.writeTextDir "index.html" ''
ACCESS GRANTED!
'';
};
}; };
} }

View file

@ -25,16 +25,17 @@ tmpl_index = """
{% for name, info in services.items() %} {% for name, info in services.items() %}
<h3>{{ info.name }}</h3> <h3>{{ info.name }}</h3>
{{ info.description }} {{ info.description }}
{% if info.url %}
<br> <br>
<a href="{{ info.url }}">{{ info.url }}</a> Link: <a href="{{ info.url }}">{{ info.url }}</a>
{% endif %}
<pre> <pre>
Package name: {{ info.package.name }} Package name: {{ info.package.name }}
Package version: {{ info.package.version }} Package version: {{ info.package.version }}
Package homepage: {{ info.package.meta.homepage }} Package homepage: {{ info.package.meta.homepage }}
License: <a href="{{ info.package.meta.license.url }}">{{ info.package.meta.license.spdxId }} ({{ info.package.meta.license.shortName }})</a> License: <a href="{{ info.package.meta.license.url }}">{{ info.package.meta.license.spdxId }} ({{ info.package.meta.license.shortName }})</a>
Unfree: {{ info.package.meta.unfree }} Unfree: {{ info.package.meta.unfree }}
</pre>
<pre>
<hr> <hr>
{% endfor %} {% endfor %}
""" """
@ -76,6 +77,7 @@ def extract_secrets() -> dict[str, str]:
@app.route("/") @app.route("/")
@app.route("/members")
def index(): def index():
# extract user information # extract user information
user_info = { user_info = {

View file

@ -20,7 +20,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; endpoint = urlpath;
vhostConfig.locations."${urlpath}" = { vhostConfig.locations."${urlpath}" = {
extraConfig = "rewrite ^${urlpath}(.*)$ /$1 break;"; # extraConfig = "rewrite ^${urlpath}(.*)$ /$1 break;";
proxyPass = "http://localhost:${builtins.toString port}"; proxyPass = "http://localhost:${builtins.toString port}";
}; };
}; };