aboutsummaryrefslogtreecommitdiff
# SPDX-License-Identifier: CC0-1.0

# Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
#
# Available under the terms of Creative Commons Zero v1.0 Universal.

import sys

_application = None

def application(environ, *args):
    global _application

    if _application is None:
        sys.path.extend(environ['HYDRILLA_GUIX_PYTHONPATH'].split(':'))

        from hydrilla.server import start_wsgi, config

        current_config = {
            **config.load(),
            'malcontent_dir': environ['MALCONENT_DIR']
        }

        _application = start_wsgi(standalone_mode=False, obj=current_config)

    return _application(environ, *args)