feat: support for extra locations

This commit is contained in:
2023-01-10 03:29:19 +01:00
parent fef784ba88
commit bfda8eecd2
2 changed files with 12 additions and 1 deletions

View File

@@ -10,6 +10,16 @@ server{
{% if acme %}
include acme-challenge.conf;
{% endif %}
{% if extra_location %}
location {{ extra_location["location"] }} {
{{ extra_location["content"] }}
{% if extra_location["location-auth"] %}
auth_basic "{{ extra_location["location-auth"] }}";
auth_basic_user_file /etc/nginx/{{ extra_location["location-auth"] }}.htpasswd;
{% endif %}
}
{% endif %}
location / {
proxy_pass http://{{ targetip }}:{{ targetport }};

3
vm.py
View File

@@ -132,7 +132,8 @@ class VM:
component = template.render(targetip=self.ip, targetport=targetport,
servernames=[subdomain["name"]], comment=compositeName,
proxy_pass_blob=self.proxy_pass_blob, acme=not self.noTerminateACME,
basicauth=subdomain.get("basicauth"))
basicauth=subdomain.get("basicauth"),
extra_location=subdomain.get("extra-location"))
components.append(component)
return components