manage: make FakeApp.config be the same thing as Quart.config

This commit is contained in:
Luna 2019-10-25 08:41:49 -03:00
parent c44e184e6e
commit 78b45b022a
1 changed files with 7 additions and 3 deletions

View File

@ -79,9 +79,13 @@ def init_parser():
def main(config): def main(config):
"""Start the script""" """Start the script"""
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
# TODO make cfg import from Quart.config.from_object
cfg = getattr(config, config.MODE) # by doing this we can "import" quart's default config keys,
app = FakeApp(cfg.__dict__) # like SERVER_NAME, required for app_context to work.
quart_app = Quart(__name__)
quart_app.config.from_object(f"config.{config.MODE}")
app = FakeApp(quart_app.config)
parser = init_parser() parser = init_parser()
loop.run_until_complete(init_app_db(app)) loop.run_until_complete(init_app_db(app))