From f3ab4f9d8ab71526a02c9fa62f558f533fe9b5c1 Mon Sep 17 00:00:00 2001 From: Andrey Snytin Date: Mon, 30 Oct 2023 20:56:55 +0100 Subject: [PATCH] core connectors whitelist in file-uploader-api --- .../dl_file_uploader_api_lib/app.py | 8 ++++++-- .../dl_file_uploader_api_lib_tests/conftest.py | 9 ++++----- .../dl_file_uploader_worker_lib_tests/conftest.py | 9 ++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib/app.py b/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib/app.py index c7210d823..34171965e 100644 --- a/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib/app.py +++ b/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib/app.py @@ -24,7 +24,10 @@ from dl_core.aio.middlewares.master_key import master_key_middleware from dl_core.aio.ping_view import PingView from dl_core.aio.web_app_services.s3 import S3Service -from dl_core.loader import load_core_lib +from dl_core.loader import ( + CoreLibraryConfig, + load_core_lib, +) from dl_file_uploader_api_lib.aiohttp_services.arq_redis import ArqRedisService from dl_file_uploader_api_lib.aiohttp_services.crypto import CryptoService from dl_file_uploader_api_lib.aiohttp_services.error_handler import FileUploaderErrorHandler @@ -59,7 +62,8 @@ def set_up_sentry(self, secret_sentry_dsn: str, release: str) -> None: ) def create_app(self, app_version: str) -> web.Application: - load_core_lib() + core_conn_whitelist = ["clickhouse", "file", "gsheets_v2"] + load_core_lib(core_lib_config=CoreLibraryConfig(core_connector_ep_names=core_conn_whitelist)) if (secret_sentry_dsn := self._settings.SENTRY_DSN) is not None: self.set_up_sentry(secret_sentry_dsn, app_version) diff --git a/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib_tests/conftest.py b/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib_tests/conftest.py index 840b77778..06f686207 100644 --- a/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib_tests/conftest.py +++ b/lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib_tests/conftest.py @@ -52,6 +52,10 @@ from dl_file_uploader_api_lib.app import FileUploaderApiAppFactory from dl_file_uploader_api_lib.dl_request import FileUploaderDLRequest from dl_file_uploader_api_lib.settings import FileUploaderAPISettings +from dl_file_uploader_api_lib_tests.config import ( + CONNECTOR_WHITELIST, + TestingUSConfig, +) from dl_file_uploader_lib.redis_model.base import RedisModelManager from dl_file_uploader_task_interface.context import FileUploaderTaskContext from dl_file_uploader_worker_lib.settings import ( @@ -74,11 +78,6 @@ from dl_connector_bundle_chs3.chs3_base.core.settings import FileS3ConnectorSettings -from dl_file_uploader_api_lib_tests.config import ( - CONNECTOR_WHITELIST, - TestingUSConfig, -) - if TYPE_CHECKING: from types_aiobotocore_s3 import S3Client as AsyncS3Client diff --git a/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib_tests/conftest.py b/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib_tests/conftest.py index 6c9cca312..d1fb73b96 100644 --- a/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib_tests/conftest.py +++ b/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib_tests/conftest.py @@ -42,6 +42,10 @@ ) from dl_file_uploader_worker_lib.tasks import REGISTRY from dl_file_uploader_worker_lib.testing.app_factory import TestingFileUploaderWorkerFactory +from dl_file_uploader_worker_lib_tests.config import ( + CONNECTOR_WHITELIST, + TestingUSConfig, +) from dl_task_processor.arq_wrapper import ( create_arq_redis_settings, create_redis_pool, @@ -67,11 +71,6 @@ from dl_connector_bundle_chs3.chs3_base.core.settings import FileS3ConnectorSettings -from dl_file_uploader_worker_lib_tests.config import ( - CONNECTOR_WHITELIST, - TestingUSConfig, -) - if TYPE_CHECKING: from mypy_boto3_s3.client import S3Client as SyncS3Client