Files
lumi/lumi/server.py
2022-12-01 05:28:19 -03:00

21 lines
621 B
Python

import gunicorn.app.base
'''
Development server for RPC
In production, use gunicorn daemon to manage the server.
'''
class DevelopmentServer(gunicorn.app.base.BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()
def load_config(self):
config = {key: value for key, value in self.options.items()
if key in self.cfg.settings and value is not None}
for key, value in config.items():
self.cfg.set(key.lower(), value)
def load(self):
return self.application