From 030872eb1728e6529d26007bc3591f0221016e4a Mon Sep 17 00:00:00 2001 From: Bau Nguyen Date: Wed, 5 Jun 2024 09:29:07 +0100 Subject: [PATCH] remove vcap --- docker-compose.e2e.backend.yml | 5 +++-- src/config/__test__/envSchema.test.js | 24 ------------------------ src/config/envSchema.js | 3 --- src/config/index.js | 12 ------------ 4 files changed, 3 insertions(+), 41 deletions(-) delete mode 100644 src/config/__test__/envSchema.test.js diff --git a/docker-compose.e2e.backend.yml b/docker-compose.e2e.backend.yml index 5bc376203ca..fbe8d53e5ab 100644 --- a/docker-compose.e2e.backend.yml +++ b/docker-compose.e2e.backend.yml @@ -49,7 +49,7 @@ services: postgres: image: postgres:16 ports: - - "5432:5432" + - '5432:5432' environment: POSTGRES_DB: datahub POSTGRES_USER: user @@ -91,7 +91,8 @@ services: - 8082:8082 environment: - PORT=8082 - - 'VCAP_SERVICES={"redis":[{"credentials":{"uri":"redis://redis:6379"}}],"opensearch":[{"credentials":{"uri":"http://some-id:some-secret@opensearch:9200"}, "plan": "123-123-123" } ] }' + - REDIS_URL=redis://redis:6379 + - OPENSEARCH=http://some-id:some-secret@opensearch:9200 - SENTRY_ENVIRONMENT=test - SENTRY_DSN=http://abc:cvb@localhost:9872/123 - FEEDS__1__UNIQUE_ID=verification_feed_app diff --git a/src/config/__test__/envSchema.test.js b/src/config/__test__/envSchema.test.js deleted file mode 100644 index 73e4639c087..00000000000 --- a/src/config/__test__/envSchema.test.js +++ /dev/null @@ -1,24 +0,0 @@ -const envSchema = require('../envSchema') - -describe('envSchema', () => { - it('should parse VCAP_SERVICES from a JSON string', () => { - const jsonString = '{"str":"ing","numb":1,"bol":false,"obj":{},"arr":[]}' - const { value } = envSchema.validate( - { - VCAP_SERVICES: jsonString, - }, - { - allowUnknown: true, - abortEarly: false, - } - ) - - expect(value.VCAP_SERVICES).to.deep.equal({ - str: 'ing', - numb: 1, - bol: false, - obj: {}, - arr: [], - }) - }) -}) diff --git a/src/config/envSchema.js b/src/config/envSchema.js index 3e81613d3b7..3106a5257fd 100644 --- a/src/config/envSchema.js +++ b/src/config/envSchema.js @@ -168,9 +168,6 @@ const envSchema = Joi.object({ .integer() .default(2 * 60 * 60 * 1000), - // Configuration object (JSON) of Cloud Foundry services - VCAP_SERVICES: ExtendedJoi.json().default({}), - // Zendesk field ID used to capture user's browser ZEN_BROWSER: Joi.string(), // Zendesk username used for API queries diff --git a/src/config/index.js b/src/config/index.js index a1a1c845f68..43c7f1935bd 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -18,18 +18,6 @@ const isTest = envVars.NODE_ENV === 'test' const root = path.normalize(`${__dirname}/../..`) const buildRedisConfig = () => { - const vcap = envVars.VCAP_SERVICES - - if (vcap && vcap.hasOwnProperty('redis')) { - return { - metadataTtl: envVars.METADATA_TTL, - url: vcap.redis[0].credentials.uri, - port: vcap.redis[0].credentials.port, - host: vcap.redis[0].credentials.host, - useTLS: vcap.redis[0].credentials.tls_enabled, - } - } - return { metadataTtl: envVars.METADATA_TTL, url: envVars.REDIS_URL || envVars.REDISTOGO_URL,