bundles/nginx: use metadata reactor to determine index files

This commit is contained in:
Franzi 2020-10-31 10:41:33 +01:00
parent 3ee570a47a
commit e2d8923dee
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 30 additions and 6 deletions

View file

@ -46,3 +46,27 @@ def letsencrypt(metadata):
},
},
}
@metadata_reactor
def index_files(metadata):
vhosts = {}
for vhost, config in metadata.get('nginx/vhosts', {}).items():
vhosts[vhost] = {
'index': [
'index.html',
'index.htm',
],
}
if config.get('php', False):
# If we're using PHP, make sure index.php is tried first
vhosts[vhost]['index'].insert(0, 'index.php')
return {
'nginx': {
'vhosts': vhosts,
},
}