From 09dab5d9118bc4be150ba7ba8574a395832b57e3 Mon Sep 17 00:00:00 2001 From: Sebastian Mahr Date: Thu, 1 Aug 2024 16:19:05 +0200 Subject: [PATCH 1/2] chore: restrict sse and sync module --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index afdd8a6a..ee504812 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,7 +28,7 @@ export function createConnectorConfig(overrides?: RuntimeConfig): ConnectorRunti .file("config-env-file", { file: `config/${process.env.NODE_CONFIG_ENV}.json` }) .file("default-file", { file: "config/default.json" }); - const connectorConfig = nconf.get(); + const connectorConfig = nconf.get() as ConnectorRuntimeConfig; if (typeof connectorConfig.modules.webhooksV2 !== "undefined") { // eslint-disable-next-line no-console @@ -37,6 +37,9 @@ export function createConnectorConfig(overrides?: RuntimeConfig): ConnectorRunti connectorConfig.modules.webhooks = _.defaultsDeep(connectorConfig.modules.webhooksV2, connectorConfig.modules.webhooks); delete connectorConfig.modules.webhooksV2; } + if (connectorConfig.modules.sync.enabled && connectorConfig.modules.sse.enabled) { + throw new Error("SSE and Sync cannot be enabled at the same time."); + } return connectorConfig; } From c1910ad72a78e70d35a3dbef6398635c10ff4c67 Mon Sep 17 00:00:00 2001 From: Sebastian Mahr Date: Thu, 1 Aug 2024 16:33:45 +0200 Subject: [PATCH 2/2] chore: implement PR comments --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index ee504812..38aea605 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,8 +37,11 @@ export function createConnectorConfig(overrides?: RuntimeConfig): ConnectorRunti connectorConfig.modules.webhooks = _.defaultsDeep(connectorConfig.modules.webhooksV2, connectorConfig.modules.webhooks); delete connectorConfig.modules.webhooksV2; } + if (connectorConfig.modules.sync.enabled && connectorConfig.modules.sse.enabled) { - throw new Error("SSE and Sync cannot be enabled at the same time."); + // eslint-disable-next-line no-console + console.warn("The SSE and Sync modules cannot be enabled at the same time, the Sync module will be disabled."); + connectorConfig.modules.sync.enabled = false; } return connectorConfig;