From 489c2386de44084f933b740a5a81f4c41c85f0a9 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 20 Mar 2022 12:35:00 +0100 Subject: [PATCH] voc.infobeamer-cms: prepare for divoc --- bundles/infobeamer-cms/items.py | 1 + bundles/infobeamer-cms/metadata.py | 66 +++++++++++------------------- nodes/voc/infobeamer-cms.py | 19 +++++++++ 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/bundles/infobeamer-cms/items.py b/bundles/infobeamer-cms/items.py index 72e078a..226fc23 100644 --- a/bundles/infobeamer-cms/items.py +++ b/bundles/infobeamer-cms/items.py @@ -40,6 +40,7 @@ directories = { } config = node.metadata.get('infobeamer-cms/config', {}) +config.setdefault('EXTRA_ASSETS', []) config['ROOMS'] = [] interrupts = [] diff --git a/bundles/infobeamer-cms/metadata.py b/bundles/infobeamer-cms/metadata.py index cced484..5ac0c46 100644 --- a/bundles/infobeamer-cms/metadata.py +++ b/bundles/infobeamer-cms/metadata.py @@ -1,51 +1,13 @@ +from datetime import datetime, timedelta + defaults = { 'infobeamer-cms': { 'config': { - 'GITHUB_CLIENT_ID': repo.vault.decrypt('encrypt$gAAAAABhxJT3JG3Qb1X-gjtBxwOXZmF-GVPjNbDkYo0Eke5Ly4CAKiussQ8Lld-4zoIWnIVBgndfPPGFDV2RlAHgb-_RY5r7jQcAlgsR0RUw4as0jEhiKlQ='), - 'GITHUB_CLIENT_SECRET': repo.vault.decrypt('encrypt$gAAAAABhxJUgYzLIm5Efbn9-sEPpQRRiskHKa7fSqNoUxgonpcn7b9e6S_WbNHH_CLGrkKi7oE3pYUticDaLLLSM0bv74lswwElNvkhUuOM-RSeEuyKEhPP-fX-NXIa_AkRkFPVVBLnw'), - 'SESSION_COOKIE_NAME': '__Host-sess', - 'PREFERRED_URL_SCHEME': 'https', - 'HOSTED_API_KEY': repo.vault.decrypt('encrypt$gAAAAABhxJPH2sIGMAibU2Us1HoCVlNfF0SQQnVl0eiod48Zu8webL_-xk3wDw3yXw1Hkglj-2usl-D3Yd095yTSq0vZMCv2fh-JWwSPdJewQ45x9Ai4vXVD4CNz5vuJBESKS9xQWXTc'), 'MAX_UPLOADS': 5, - 'SETUP_IDS': [ - 212947, - ], + 'PREFERRED_URL_SCHEME': 'https', + 'SESSION_COOKIE_NAME': '__Host-sess', 'URL_KEY': repo.vault.password_for(f'{node.name} infobeamer-cms url key'), - 'MQTT_SERVER': 'mqtt.c3voc.de', - 'MQTT_USERNAME': repo.vault.decrypt('encrypt$gAAAAABhxakKHC_kHmHP2mFHorb4niuNTH4F24w1D6m5JUxl117N7znlZA6fpMmY3_NcmBr2Ihw4hL3FjZr9Fm_1oUZ1ZQdADA=='), - 'MQTT_PASSWORD': repo.vault.decrypt('encrypt$gAAAAABhxakfhhwWn0vxhoO1FiMEpdCkomWvo0dHIuBrqDKav8WDpI6dXpb0hoXiWRsPV6p5m-8RlbfFbjPhz47AY-nFOOAAW6Yis3-IVD-U-InKJo9dvms='), - 'MQTT_TOPIC': '/voc/alert', - 'MQTT_MESSAGE': '{{"level":"info","component":"infobeamer-cms","msg":"{asset} uploaded by {user}. Check it at {url}"}}', - 'TIME_MIN': 1640559600, - 'TIME_MAX': 1640905200, 'VERSION': 1, - 'EXTRA_ASSETS': [{ - 'type': "image", - 'asset': 828107, # fairydust - # bottom left, 10px from border - 'x1': 10, - 'y1': 1004, - 'x2': 110, - 'y2': 1070, - }], - }, - 'domain': 'infobeamer-cms.c3voc.de', - 'rooms': { - 'Chaos-West TV': 17968, - 'Chaosstudio Hamburg': 3284, - 'ChaosZone TV': 3, - 'r3s - Monheim/Rhein': 22460, - 'franconian.net Livestream': 246100657, - 'about:future stage': 246100658, - 'Sendezentrum Bühne': 246100659, - 'Haecksen Stream': 246100660, - 'xHain Mainhall': 246100661, - 'xHain Workshop-Area': 246100662, - 'c-base': 246100663, - 'about:future Kitchen': 246100664, - 'Haecksen Zur schönen Mary': 246100665, - 'Haecksen Zur magischen Margaret': 246100666, - 'infobeamer stream': 15586, }, 'workers': 4, }, @@ -81,3 +43,23 @@ def nginx(metadata): }, }, } + + +@metadata_reactor.provides( + 'infobeamer-cms/config/TIME_MAX', + 'infobeamer-cms/config/TIME_MIN', +) +def event_times(metadata): + event_start = datetime.strptime(metadata.get('infobeamer-cms/event_start_date'), '%Y-%m-%d') + event_duration = metadata.get('infobeamer-cms/event_duration_days', 4) + + event_end = event_start + timedelta(days=event_duration) + + return { + 'infobeamer-cms': { + 'config': { + 'TIME_MAX': int(event_end.timestamp()), + 'TIME_MIN': int(event_start.timestamp()), + }, + }, + } diff --git a/nodes/voc/infobeamer-cms.py b/nodes/voc/infobeamer-cms.py index e03e6f8..d7655d8 100644 --- a/nodes/voc/infobeamer-cms.py +++ b/nodes/voc/infobeamer-cms.py @@ -25,5 +25,24 @@ nodes['voc.infobeamer-cms'] = { 'icinga_options': { 'pretty_name': 'infobeamer-cms.c3voc.de', }, + 'infobeamer-cms': { + 'domain': 'infobeamer-cms.c3voc.de', + 'event_start_date': '2022-04-15', + 'config': { + 'ADMIN_USERS': ['kunsi'], + 'GITHUB_CLIENT_ID': vault.decrypt('encrypt$gAAAAABiNwHfIu9PYFfJrF7qirn_9vdvvUlEhJnadoNSS5XlCDbI_aMyj21_ZYQxaCkc6_eVX6Cj1jEHZ7Vs6wM-XyQdW0nUOahtqG4uvnYCiM3GFKHW_wQ='), + 'GITHUB_CLIENT_SECRET': vault.decrypt('encrypt$gAAAAABiNwHtdZC2XQ8IjosL7vsmrxZMwDIM6AD5dUlLo996tJs4qV7KJETHgYYZil2aMzClwhcE6JmxdhARRp7IJQ4rQQibelTNmyYSzj_V4puVpvma7SU0UZkTIG95SdPpoHY--Zba'), + 'HOSTED_API_KEY': vault.decrypt('encrypt$gAAAAABhxJPH2sIGMAibU2Us1HoCVlNfF0SQQnVl0eiod48Zu8webL_-xk3wDw3yXw1Hkglj-2usl-D3Yd095yTSq0vZMCv2fh-JWwSPdJewQ45x9Ai4vXVD4CNz5vuJBESKS9xQWXTc'), + 'MQTT_MESSAGE': '{{"level":"info","component":"infobeamer-cms","msg":"{asset} uploaded by {user}. Check it at {url}"}}', + 'MQTT_PASSWORD': vault.decrypt('encrypt$gAAAAABhxakfhhwWn0vxhoO1FiMEpdCkomWvo0dHIuBrqDKav8WDpI6dXpb0hoXiWRsPV6p5m-8RlbfFbjPhz47AY-nFOOAAW6Yis3-IVD-U-InKJo9dvms='), + 'MQTT_SERVER': 'mqtt.c3voc.de', + 'MQTT_TOPIC': '/voc/alert', + 'MQTT_USERNAME': vault.decrypt('encrypt$gAAAAABhxakKHC_kHmHP2mFHorb4niuNTH4F24w1D6m5JUxl117N7znlZA6fpMmY3_NcmBr2Ihw4hL3FjZr9Fm_1oUZ1ZQdADA=='), + 'SETUP_IDS': [228806], + }, + 'rooms': { + 'infobeamer stream': 23541, + }, + }, }, }