Gateway: Split some of main() into setup_bottle_app()

* This *should* facilitate some easier testing.
This commit is contained in:
Athanasius 2022-08-19 15:13:33 +01:00
parent 8a5bd46c33
commit 00fed9b36a
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62

View File

@ -400,15 +400,8 @@ def apply_cors() -> None:
)
def main() -> None:
"""Handle setting up and running the bottle app."""
cl_args = parse_cl_args()
if cl_args.loglevel:
logger.setLevel(cl_args.loglevel)
load_config(cl_args)
configure()
def setup_bottle_app() -> dict:
"""Handle setup of the bottle app."""
app.add_hook("after_request", apply_cors)
# Build arg dict for args
@ -425,6 +418,20 @@ def main() -> None:
argsd["certfile"] = Settings.CERT_FILE
argsd["keyfile"] = Settings.KEY_FILE
return argsd
def main() -> None:
"""Take note of configuration and start bottle app."""
cl_args = parse_cl_args()
if cl_args.loglevel:
logger.setLevel(cl_args.loglevel)
load_config(cl_args)
configure()
argsd = setup_bottle_app()
logger.info('Starting bottle app...')
app.run(
**argsd,