From 06a7801d8ceba625733809a2b245ad830e02ee4b Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 15 Aug 2024 15:37:51 +0100 Subject: [PATCH] Remove global audit logs SQS flag. --- packages/backend-core/src/features/index.ts | 3 +-- packages/pro | 2 +- .../worker/src/api/routes/global/tests/auditLogs.spec.ts | 7 ++++--- packages/worker/src/index.ts | 4 ---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/backend-core/src/features/index.ts b/packages/backend-core/src/features/index.ts index 42cd5a79b4..d1d757d8a9 100644 --- a/packages/backend-core/src/features/index.ts +++ b/packages/backend-core/src/features/index.ts @@ -136,10 +136,9 @@ export class FlagSet, T extends { [key: string]: V }> { return cachedFlags } - const currentContext = context.getCurrentContext() const tags: Record = {} const flagValues = this.defaults() - const currentTenantId = currentContext?.tenantId + const currentTenantId = context.getTenantId() const specificallySetFalse = new Set() const split = (env.TENANT_FEATURE_FLAGS || "") diff --git a/packages/pro b/packages/pro index 5678433b7c..d4f83bf74a 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 5678433b7cfb3f121fbf837a0d6ddeeee054a7ed +Subproject commit d4f83bf74a80a3e8a1e0c29aa1adc7231fe76d49 diff --git a/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts b/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts index 92a366bf4e..350c9a7edc 100644 --- a/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts +++ b/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts @@ -1,7 +1,6 @@ import { mocks, structures } from "@budibase/backend-core/tests" -import { context, events } from "@budibase/backend-core" +import { context, events, setEnv as setCoreEnv } from "@budibase/backend-core" import { Event, IdentityType } from "@budibase/types" -import { auditLogs } from "@budibase/pro" import { TestConfiguration } from "../../../../tests" mocks.licenses.useAuditLogs() @@ -15,15 +14,17 @@ const APP_ID = "app_1" describe.each(["lucene", "sql"])("/api/global/auditlogs (%s)", method => { const config = new TestConfiguration() + let envCleanup: (() => void) | undefined beforeAll(async () => { if (method === "sql") { - auditLogs.useSQLSearch() + envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" }) } await config.beforeAll() }) afterAll(async () => { + envCleanup?.() await config.afterAll() }) diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index bb8a398ed6..3c047e1a44 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -101,10 +101,6 @@ export default server.listen(parseInt(env.PORT || "4002"), async () => { // configure events to use the pro audit log write // can't integrate directly into backend-core due to cyclic issues await events.processors.init(proSdk.auditLogs.write) - - if (await features.flags.isEnabled("SQS")) { - sdk.auditLogs.useSQLSearch() - } }) process.on("uncaughtException", err => {