do_web_update: Order the domains in some way before writing to the nginx local.conf

This commit is contained in:
David Duque 2021-04-13 23:01:18 +01:00
parent b9bdf50628
commit 40babe3e03
No known key found for this signature in database
GPG key ID: 913FE0F2477D7D6B

View file

@ -129,7 +129,11 @@ def do_web_update(env):
nginx_conf += make_domain_config(env['PRIMARY_HOSTNAME'], [template0, template1, template2], ssl_certificates, env)
# Add configuration all other web domains.
for domain, flags in get_web_domain_flags(env).items():
pairs = list(get_web_domain_flags(env).items())
# Sort the domains in some way to keep ordering consistency. Keep domains and subdomains together.
pairs.sort(reverse = False, key = lambda x: x[0][::-1])
for domain, flags in pairs:
if flags & DOMAIN_PRIMARY == DOMAIN_PRIMARY or flags == DOMAIN_EXTERNAL:
# PRIMARY_HOSTNAME is handled above.
continue