From bb752563ccd55d08dc151948a841762990bfde34 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 11 Jan 2024 12:25:35 -0500 Subject: [PATCH] aimedb: add enable toggle --- core/config.py | 6 ++++++ example_config/core.yaml | 1 + index.py | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/config.py b/core/config.py index ee99df7..3d5f6fb 100644 --- a/core/config.py +++ b/core/config.py @@ -314,6 +314,12 @@ class AimedbConfig: def __init__(self, parent_config: "CoreConfig") -> None: self.__config = parent_config + @property + def enable(self) -> bool: + return CoreConfig.get_config_field( + self.__config, "core", "aimedb", "enable", default=True + ) + @property def loglevel(self) -> int: return CoreConfig.str_to_loglevel( diff --git a/example_config/core.yaml b/example_config/core.yaml index 2567f0b..05f664a 100644 --- a/example_config/core.yaml +++ b/example_config/core.yaml @@ -54,6 +54,7 @@ billing: signing_key: "cert/billing.key" aimedb: + enable: True loglevel: "info" port: 22345 key: "" diff --git a/index.py b/index.py index fbd68d0..3a85768 100644 --- a/index.py +++ b/index.py @@ -69,14 +69,16 @@ async def launch_allnet(cfg: CoreConfig) -> None: async def launcher(cfg: CoreConfig, ssl: bool) -> None: - AimedbServlette(cfg).start() task_list = [asyncio.create_task(launch_main(cfg, ssl))] + if cfg.billing.standalone: task_list.append(asyncio.create_task(launch_billing(cfg))) if cfg.frontend.enable: task_list.append(asyncio.create_task(launch_frontend(cfg))) if cfg.allnet.standalone: task_list.append(asyncio.create_task(launch_allnet(cfg))) + if cfg.aimedb.enable: + AimedbServlette(cfg).start() done, pending = await asyncio.wait( task_list,