From 3eb51a32ce3d6535abe1810bcc6f5760f3bfda42 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 7 Aug 2025 15:35:33 +0200 Subject: [PATCH] Adapted webserver test for web-app-yourls --- .../templates/sys-hlth-webserver.py.j2 | 2 +- roles/web-app-yourls/config/main.yml | 2 ++ .../web-app-yourls/templates/redirect.conf.j2 | 2 +- roles/web-app-yourls/vars/main.yml | 19 ++++++++++--------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/roles/sys-hlth-webserver/templates/sys-hlth-webserver.py.j2 b/roles/sys-hlth-webserver/templates/sys-hlth-webserver.py.j2 index 160a4de9..c7d16ffc 100644 --- a/roles/sys-hlth-webserver/templates/sys-hlth-webserver.py.j2 +++ b/roles/sys-hlth-webserver/templates/sys-hlth-webserver.py.j2 @@ -20,7 +20,7 @@ def get_expected_statuses(domain: str, parts: list[str], redirected_domains: set if (parts and parts[0] == 'www') or (domain in redirected_domains): return [301] if domain == '{{domains | get_domain('web-app-yourls')}}': - return [403] + return [{{ applications | get_app_conf(application_id, 'server.status_code.landingpage', True) }}] return [200, 302, 301] # file in which fqdn server configs are deposit diff --git a/roles/web-app-yourls/config/main.yml b/roles/web-app-yourls/config/main.yml index bf5984c4..d54406ab 100644 --- a/roles/web-app-yourls/config/main.yml +++ b/roles/web-app-yourls/config/main.yml @@ -29,6 +29,8 @@ server: unsafe-inline: true locations: admin: "/admin/" + status_code: + landingpage: 301 docker: services: database: diff --git a/roles/web-app-yourls/templates/redirect.conf.j2 b/roles/web-app-yourls/templates/redirect.conf.j2 index 28687e05..990461af 100644 --- a/roles/web-app-yourls/templates/redirect.conf.j2 +++ b/roles/web-app-yourls/templates/redirect.conf.j2 @@ -1,3 +1,3 @@ location = / { - return 301 {{ yourls_admin_location }}; + return {{ yourls_landingpage_status_code }} {{ yourls_admin_location }}; } \ No newline at end of file diff --git a/roles/web-app-yourls/vars/main.yml b/roles/web-app-yourls/vars/main.yml index bc50b04e..ae1eea91 100644 --- a/roles/web-app-yourls/vars/main.yml +++ b/roles/web-app-yourls/vars/main.yml @@ -1,14 +1,15 @@ # General -application_id: "web-app-yourls" -database_type: "mariadb" +application_id: "web-app-yourls" +database_type: "mariadb" # Yourls Specific -yourls_user: "{{ applications | get_app_conf(application_id, 'users.administrator.username', True) }}" -yourls_password: "{{ applications | get_app_conf(application_id, 'credentials.administrator_password', True) }}" -yourls_version: "{{ applications | get_app_conf(application_id, 'docker.services.yourls.version', True) }}" -yourls_image: "{{ applications | get_app_conf(application_id, 'docker.services.yourls.image', True) }}" -yourls_container: "{{ applications | get_app_conf(application_id, 'docker.services.yourls.name', True) }}" -yourls_admin_location: "{{ applications | get_app_conf(application_id, 'server.locations.admin', True) }}" +yourls_user: "{{ applications | get_app_conf(application_id, 'users.administrator.username', True) }}" +yourls_password: "{{ applications | get_app_conf(application_id, 'credentials.administrator_password', True) }}" +yourls_version: "{{ applications | get_app_conf(application_id, 'docker.services.yourls.version', True) }}" +yourls_image: "{{ applications | get_app_conf(application_id, 'docker.services.yourls.image', True) }}" +yourls_container: "{{ applications | get_app_conf(application_id, 'docker.services.yourls.name', True) }}" +yourls_admin_location: "{{ applications | get_app_conf(application_id, 'server.locations.admin', True) }}" +yourls_landingpage_status_code: "{{ applications | get_app_conf(application_id, 'server.status_code.landingpage', True) }}" # Nginx Specific -proxy_extra_configuration: "{{ lookup('template', 'redirect.conf.j2') }}" +proxy_extra_configuration: "{{ lookup('template', 'redirect.conf.j2') }}"