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

20 lines
709 B
SYSTEMD
Raw Normal View History

%set %%domains = set()
2022-08-18 10:19:43 +02:00
%for %%domainname in %%nginx.remotes
2022-03-08 19:42:28 +01:00
%set %%family = %%normalize_family(%%domainname)
%set %%revprox = %%nginx['reverse_proxy_for_' + family]['reverse_proxy_' + family]
2022-08-18 10:19:43 +02:00
%for %%domain in %%revprox['revprox_domainnames_' + family]
%set %%domain = %%domain['revprox_url_' + family].split('/', 3)[2].split(':')[0]
%%domains.add(%%domain)%slurp
2022-03-08 19:42:28 +01:00
%end for
%end for
%set %%domains = %%list(%%domains)
%%domains.sort()
2022-03-08 19:42:28 +01:00
%if %%domains
%set %%domains_str = " ".join(%%domains)
[Service]
ExecStartPre=
ExecStartPre=/usr/bin/timeout 90 sh -c 'while ! /usr/bin/resolvectl query %%domains_str; do sleep 1; done'
ExecStartPre=/usr/bin/rm -f /run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
%end if