From adfb09b9e19f7a31632eab01171693cb81ec75ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= <me@rgoncalves.se>
Date: Thu, 8 Feb 2024 13:32:37 +0100
Subject: refactor(roles): new variable naming standard

---
 roles/httpd/templates/httpd.conf.j2 | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

(limited to 'roles/httpd/templates')

diff --git a/roles/httpd/templates/httpd.conf.j2 b/roles/httpd/templates/httpd.conf.j2
index 49e928d..9225244 100644
--- a/roles/httpd/templates/httpd.conf.j2
+++ b/roles/httpd/templates/httpd.conf.j2
@@ -1,24 +1,38 @@
 # managed by Ansible
 
 types {
-{% for type in httpd_supported_types %}
+{% for type in httpd__supported_types %}
 	{{ type }}
 {% endfor %}
 }
 
-server "acme" {
-	listen on localhost port 8888
+server "default" {
+	listen on * port 8888
+	log style {{ httpd__log_format }}
 
+	# acme tls challenge
 	location "/.well-known/acme-challenge/*" {
 		root "/acme"
 		request strip 2
 	}
 
+	# redirection
 	location * {
 		block return 302 "https://$HTTP_HOST$REQUEST_URI"
 	}
 }
 
-{% for file in httpd_configuration_files.files %}
+{% for item in httpd__rules  %}
+{% if item.extra.type is defined and item.extra.type == "static" %}
+server "{{ item.domain }}" {
+	listen on localhost port {{ item.port }}
+	log style {{ httpd__log_format }}
+	root "{{ httpd_pre__chroot_sites_dir }}/{{ item.domain }}"
+}
+
+{% endif %}
+{% endfor %}
+
+{% for file in httpd__configuration_files.files %}
 include "{{ file.path }}"
 {% endfor %}
-- 
cgit v1.2.3