mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-13 21:36:35 +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:
|
def setup_bottle_app() -> dict:
|
||||||
"""Handle setting up and running the bottle app."""
|
"""Handle setup of the bottle app."""
|
||||||
cl_args = parse_cl_args()
|
|
||||||
if cl_args.loglevel:
|
|
||||||
logger.setLevel(cl_args.loglevel)
|
|
||||||
|
|
||||||
load_config(cl_args)
|
|
||||||
configure()
|
|
||||||
|
|
||||||
app.add_hook("after_request", apply_cors)
|
app.add_hook("after_request", apply_cors)
|
||||||
|
|
||||||
# Build arg dict for args
|
# Build arg dict for args
|
||||||
@ -425,6 +418,20 @@ def main() -> None:
|
|||||||
argsd["certfile"] = Settings.CERT_FILE
|
argsd["certfile"] = Settings.CERT_FILE
|
||||||
argsd["keyfile"] = Settings.KEY_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...')
|
logger.info('Starting bottle app...')
|
||||||
app.run(
|
app.run(
|
||||||
**argsd,
|
**argsd,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user