From ab4b44a0bcbdf1b5f16d315a8511539fd627fee9 Mon Sep 17 00:00:00 2001 From: Tal Date: Sun, 29 Sep 2024 15:30:19 +0300 Subject: [PATCH] fix(startup): provisioning only in specific auth types (#2022) --- keep/api/api.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/keep/api/api.py b/keep/api/api.py index 1ca20f744..4e4b3d939 100644 --- a/keep/api/api.py +++ b/keep/api/api.py @@ -78,6 +78,7 @@ CONSUMER = os.environ.get("CONSUMER", "true") == "true" AUTH_TYPE = os.environ.get("AUTH_TYPE", AuthenticationType.NO_AUTH.value) +PROVISION_RESOURCES = os.environ.get("PROVISION_RESOURCES", "true") == "true" try: KEEP_VERSION = metadata.version("keep") except Exception: @@ -253,12 +254,13 @@ def get_app( async def on_startup(): logger.info("Loading providers into cache") ProvidersFactory.get_all_providers() - # provision providers from env. relevant only on single tenant. - logger.info("Provisioning providers and workflows") - ProvidersService.provision_providers_from_env(SINGLE_TENANT_UUID) - logger.info("Providers loaded successfully") - WorkflowStore.provision_workflows_from_directory(SINGLE_TENANT_UUID) - logger.info("Workflows provisioned successfully") + if PROVISION_RESOURCES: + # provision providers from env. relevant only on single tenant. + logger.info("Provisioning providers and workflows") + ProvidersService.provision_providers_from_env(SINGLE_TENANT_UUID) + logger.info("Providers loaded successfully") + WorkflowStore.provision_workflows_from_directory(SINGLE_TENANT_UUID) + logger.info("Workflows provisioned successfully") # Start the services logger.info("Starting the services") # Start the scheduler