directories['/opt/icinga2-statuspage/src'] = {}

git_deploy['/opt/icinga2-statuspage/src'] = {
    'repo': 'https://git.franzi.business/kunsi/icinga-dynamic-statuspage.git',
    'rev': 'main',
    'triggers': {
        'svc_systemd:icinga2-statuspage:restart',
    },
}

files['/opt/icinga2-statuspage/config.json'] = {
    'content': repo.libs.faults.dict_as_json(node.metadata.get('icinga2-statuspage')),
    'triggers': {
        'svc_systemd:icinga2-statuspage:restart',
    },
}

files['/usr/local/lib/systemd/system/icinga2-statuspage.service'] = {
    'triggers': {
        'action:systemd-reload',
        'svc_systemd:icinga2-statuspage:restart',
    },
}


svc_systemd['icinga2-statuspage'] = {
    'needs': {
        'file:/opt/icinga2-statuspage/config.json',
        'git_deploy:/opt/icinga2-statuspage/src',
        'pkg_apt:gunicorn',
        'pkg_apt:python3-flask',
        'pkg_apt:python3-psycopg2',
    },
}
