From 5ce9bb7070fa01b88f3050ab10ad37fdb451816b Mon Sep 17 00:00:00 2001 From: IchthysMaranathaCopy Date: Wed, 13 Mar 2024 22:44:42 +0530 Subject: [PATCH] Add files via upload --- .../src/api/controllers/system/environment.ts | 35 +++---------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/packages/worker/src/api/controllers/system/environment.ts b/packages/worker/src/api/controllers/system/environment.ts index f114cc63cf7..9b31e460b6d 100644 --- a/packages/worker/src/api/controllers/system/environment.ts +++ b/packages/worker/src/api/controllers/system/environment.ts @@ -1,41 +1,14 @@ -import { Ctx } from "@budibase/types" +import { BBContext } from "@budibase/types" import env from "../../../environment" -import { env as coreEnv } from "@budibase/backend-core" -import nodeFetch from "node-fetch" -let sqsAvailable: boolean -async function isSqsAvailable() { - if (sqsAvailable !== undefined) { - return sqsAvailable - } - - try { - await nodeFetch(coreEnv.COUCH_DB_SQL_URL, { - timeout: 1000, - }) - sqsAvailable = true - return true - } catch (e) { - sqsAvailable = false - return false - } -} - -export const fetch = async (ctx: Ctx) => { +export const fetch = async (ctx: BBContext) => { ctx.body = { multiTenancy: !!env.MULTI_TENANCY, - offlineMode: !!coreEnv.OFFLINE_MODE, cloud: !env.SELF_HOSTED, accountPortalUrl: env.ACCOUNT_PORTAL_URL, disableAccountPortal: env.DISABLE_ACCOUNT_PORTAL, - baseUrl: env.PLATFORM_URL, - isDev: env.isDev() && !env.isTest(), directoidc: env.DIRECT_OIDC, - } - - if (env.SELF_HOSTED) { - ctx.body.infrastructure = { - sqs: await isSqsAvailable(), - } + // in test need to pretend its in production for the UI (Cypress) + isDev: env.isDev() && !env.isTest(), } }