bundlewrap/bundles/wordpress/metadata.py
2024-02-04 12:48:19 +01:00

66 lines
1.4 KiB
Python

defaults = {}
@metadata_reactor.provides(
'wordpress',
)
def wordpress(metadata):
return {
'wordpress': {
site: {
'db_password': repo.vault.password_for(f"wordpress {site} db").value,
}
for site in metadata.get('wordpress')
},
}
@metadata_reactor.provides(
'mariadb',
)
def mariadb(metadata):
return {
'mariadb': {
'databases': {
site: {
'password': metadata.get(f'wordpress/{site}/db_password')
}
for site in metadata.get('wordpress')
},
},
}
@metadata_reactor.provides(
'nginx/vhosts'
)
def vhost(metadata):
return {
'nginx': {
'vhosts': {
conf['domain']: {
'content': 'wordpress/vhost.conf',
'context': {
'root': f'/opt/{site}',
},
}
for site, conf in metadata.get('wordpress').items()
},
},
}
@metadata_reactor.provides(
'zfs/datasets',
)
def zfs(metadata):
return {
'zfs': {
'datasets': {
f'tank/{site}': {
'mountpoint': f'/opt/{site}',
}
for site in metadata.get('wordpress')
},
},
}