dataset/seed/nginx-reverse-proxy/templates/nginx.service

20 lines
714 B
SYSTEMD
Raw Permalink Normal View History

2023-06-23 08:12:05 +02:00
{% set domains = [] %}
{% for domainname in nginx.remotes %}
{% set family = domainname|normalize_family %}
{% set revprox = nginx['reverse_proxy_for_' + family]['reverse_proxy_' + family] %}
{% for domain in revprox['revprox_domainnames_' + family] %}
{% set domain = domain['revprox_url_' + family].split('/', 3)[2].split(':')[0] %}
{% if domain not in domains %}
{{ domains.append(domain) }}
{% endif %}
{% endfor %}
{% endfor %}
{% if domains %}
{% set domains_str = " ".join(domains) %}
2022-03-08 19:42:28 +01:00
[Service]
ExecStartPre=
2023-06-23 08:12:05 +02:00
ExecStartPre=/usr/bin/timeout 90 sh -c 'while ! /usr/bin/resolvectl query {{ domains_str }}; do sleep 1; done'
2022-03-08 19:42:28 +01:00
ExecStartPre=/usr/bin/rm -f /run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
2023-06-23 08:12:05 +02:00
{% endif %}