aboutsummaryrefslogtreecommitdiff
path: root/hydrilla-wsgi.py
blob: 45ec248a0a88d8a81b202e7c26b73cafbd006a82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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)