mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-27 05:32:13 +03:00
Gateway: Split some of main()
into setup_bottle_app()
* This *should* facilitate some easier testing.
This commit is contained in:
parent
8a5bd46c33
commit
00fed9b36a
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user