bundles/mautrix-telegram: handle registration.yaml ourselves
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-09-12 12:59:34 +02:00
parent a69f049ce2
commit 2361466c84
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 26 additions and 18 deletions

View file

@ -0,0 +1,15 @@
id: telegram
as_token: ${node.metadata['mautrix-telegram']['as_token']}
hs_token: ${node.metadata['mautrix-telegram']['hs_token']}
namespaces:
users:
- exclusive: true
regex: '@telegram_.+:${node.metadata['mautrix-telegram']['homeserver']['domain']}'
- exclusive: true
regex: '@telegrambot:${node.metadata['mautrix-telegram']['homeserver']['domain']}'
aliases:
- exclusive: true
regex: '#telegram_.+:${node.metadata['mautrix-telegram']['homeserver']['domain']}'
url: http://${node.metadata['mautrix-telegram'].get('listen-addr', '127.0.0.1')}:${node.metadata['mautrix-telegram'].get('port', 21000)}
sender_localpart: ${node.metadata['mautrix-telegram']['sender_localpart']}
rate_limited: false

View file

@ -13,20 +13,9 @@ actions = {
'action:mautrix-telegram_create_virtualenv',
},
'triggers': {
'action:mautrix-telegram_generate_registration',
'action:mautrix-telegram_upgrade_database',
},
},
'mautrix-telegram_generate_registration': {
'command': '/opt/mautrix-telegram/venv/bin/python3 -m mautrix_telegram -c /opt/mautrix-telegram/config.yaml -r /opt/mautrix-telegram/registration.yaml -g',
'needs': {
'file:/opt/mautrix-telegram/config.yaml',
},
'triggers': {
'svc_systemd:mautrix-telegram:restart',
},
'triggered': True,
},
'mautrix-telegram_init_alembic': {
'command': '/opt/mautrix-telegram/venv/bin/alembic -c /opt/mautrix-telegram/alembic.ini -x /opt/mautrix-telegram/config.yaml init /opt/mautrix-telegram/alembic',
'unless': 'test -d /opt/mautrix-telegram/alembic',
@ -37,9 +26,6 @@ actions = {
'mautrix-telegram_upgrade_database': {
'command': '/opt/mautrix-telegram/venv/bin/alembic -c /opt/mautrix-telegram/alembic.ini -x /opt/mautrix-telegram/config.yaml upgrade head',
'needs': {
# Actually, the dependency is 'mautrix-telegram has run
# atleast once, but we can't check that.
'action:mautrix-telegram_generate_registration',
'action:mautrix-telegram_init_alembic',
'postgres_db:mautrix-telegram',
'postgres_role:mautrix-telegram',
@ -51,9 +37,9 @@ actions = {
svc_systemd = {
'mautrix-telegram': {
'needs': {
'action:mautrix-telegram_generate_registration',
'action:mautrix-telegram_upgrade_database',
'file:/etc/systemd/system/mautrix-telegram.service',
'file:/opt/mautrix-telegram/config.yaml',
'postgres_db:mautrix-telegram',
'postgres_role:mautrix-telegram',
},
@ -61,6 +47,12 @@ svc_systemd = {
}
files = {
'/opt/mautrix-telegram/registration.yaml': {
'content_type': 'mako',
'triggers': {
'svc_systemd:mautrix-telegram:restart',
},
},
'/opt/mautrix-telegram/config.yaml': {
'content_type': 'mako',
'triggers': {
@ -76,4 +68,4 @@ files = {
}
if node.has_bundle('matrix-synapse'):
actions['mautrix-telegram_generate_registration']['triggers'].add('svc_systemd:matrix-synapse:restart')
files['/opt/mautrix-telegram/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')

View file

@ -16,6 +16,9 @@ defaults = {
'password': repo.vault.password_for('{} postgresql mautrix-telegram'.format(node.name)),
'database': 'mautrix-telegram',
},
'as_token': repo.vault.password_for('{} mautrix-telegram as_token'.format(node.name)),
'hs_token': repo.vault.password_for('{} mautrix-telegram hs_token'.format(node.name)),
'sender_localpart': repo.vault.password_for('{} mautrix-telegram sender_localpart'.format(node.name)),
},
'postgresql': {
'users': {