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,
            ],
            '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,
    },
}

@metadata_reactor.provides(
    'nginx/vhosts',
)
def nginx(metadata):
    if not node.has_bundle('nginx'):
        raise DoNotRunAgain

    return {
        'nginx': {
            'vhosts': {
                'infobeamer-cms': {
                    'domain': node.metadata.get('infobeamer-cms/domain'),
                    'locations': {
                        '/': {
                            'target': 'http://127.0.0.1:8000',
                        },
                        '/sync': {
                            'return': 'forbidden',
                            'mode': 403,
                        },
                        '/static': {
                            'alias': '/opt/infobeamer-cms/src/static',
                        },
                    },
                    'website_check_path': '/',
                    'website_check_string': 'Share your projects',
                },
            },
        },
    }
