From dab4c1555f1befed16536eaee593269e2c0c01e7 Mon Sep 17 00:00:00 2001 From: Max Kurapov Date: Tue, 10 Dec 2024 20:41:11 +0100 Subject: [PATCH] chore(backend, localenv): replace OPERATOR_TENANT_SECRET with existing API_SECRET --- localenv/cloud-nine-wallet/docker-compose.yml | 1 - packages/backend/jest.env.js | 3 +-- .../migrations/20241205153035_seed_operator_tenant.js | 8 ++++---- packages/backend/src/config/app.ts | 5 ++--- .../testenv/cloud-nine-wallet/docker-compose.yml | 2 +- .../testenv/happy-life-bank/docker-compose.yml | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/localenv/cloud-nine-wallet/docker-compose.yml b/localenv/cloud-nine-wallet/docker-compose.yml index cda5289205..6f22a11e27 100644 --- a/localenv/cloud-nine-wallet/docker-compose.yml +++ b/localenv/cloud-nine-wallet/docker-compose.yml @@ -79,7 +79,6 @@ services: ENABLE_TELEMETRY: true KEY_ID: 7097F83B-CB84-469E-96C6-2141C72E22C0 OPERATOR_TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787 - OPERATOR_TENANT_SECRET: 4RRtVErbQqdI9E6o6vOOKuLEbchVvOBvFIXzLWX9GWQ= depends_on: - shared-database - shared-redis diff --git a/packages/backend/jest.env.js b/packages/backend/jest.env.js index 6f9abf5f71..5509b4f583 100644 --- a/packages/backend/jest.env.js +++ b/packages/backend/jest.env.js @@ -13,5 +13,4 @@ process.env.ENABLE_TELEMETRY = false process.env.AUTH_ADMIN_API_URL = 'http://127.0.0.1:3003/graphql' process.env.AUTH_ADMIN_API_SECRET = 'test-secret' process.env.OPERATOR_TENANT_ID = 'cf5fd7d3-1eb1-4041-8e43-ba45747e9e5d' -process.env.OPERATOR_TENANT_SECRET = - 'KQEXlZO65jUJXakXnLxGO7dk387mt71G9tZ42rULSNU=' +process.env.API_SECRET = 'KQEXlZO65jUJXakXnLxGO7dk387mt71G9tZ42rULSNU=' diff --git a/packages/backend/migrations/20241205153035_seed_operator_tenant.js b/packages/backend/migrations/20241205153035_seed_operator_tenant.js index c6fa307954..6af21658c1 100644 --- a/packages/backend/migrations/20241205153035_seed_operator_tenant.js +++ b/packages/backend/migrations/20241205153035_seed_operator_tenant.js @@ -4,18 +4,18 @@ */ const OPERATOR_TENANT_ID = process.env['OPERATOR_TENANT_ID'] -const OPERATOR_TENANT_SECRET = process.env['OPERATOR_TENANT_SECRET'] +const OPERATOR_API_SECRET = process.env['API_SECRET'] exports.up = function (knex) { - if (!OPERATOR_TENANT_ID || !OPERATOR_TENANT_SECRET) { + if (!OPERATOR_TENANT_ID || !OPERATOR_API_SECRET) { throw new Error( - 'Could not seed operator tenant. Please configure OPERATOR_TENANT_ID and OPERATOR_TENANT_SECRET environment variables' + 'Could not seed operator tenant. Please configure OPERATOR_TENANT_ID and API_SECRET environment variables' ) } return knex.raw(` INSERT INTO "tenants" ("id", "apiSecret") - VALUES ('${OPERATOR_TENANT_ID}', '${OPERATOR_TENANT_SECRET}') + VALUES ('${OPERATOR_TENANT_ID}', '${OPERATOR_API_SECRET}') `) } diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index 7483b7755d..ec70dbb608 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -162,7 +162,7 @@ export const Config = { signatureSecret: process.env.SIGNATURE_SECRET, // optional signatureVersion: envInt('SIGNATURE_VERSION', 1), - adminApiSecret: process.env.API_SECRET, // optional + adminApiSecret: envString('API_SECRET'), adminApiSignatureVersion: envInt('API_SIGNATURE_VERSION', 1), adminApiSignatureTtl: envInt('ADMIN_API_SIGNATURE_TTL_SECONDS', 30), @@ -196,8 +196,7 @@ export const Config = { 5 ), localCacheDuration: envInt('LOCAL_CACHE_DURATION_MS', 15_000), - operatorTenantId: envString('OPERATOR_TENANT_ID'), - operatorTenantSecret: envString('OPERATOR_TENANT_SECRET') + operatorTenantId: envString('OPERATOR_TENANT_ID') } function parseRedisTlsConfig( diff --git a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml index 343167e4a9..02bdc3d156 100644 --- a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml +++ b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml @@ -41,7 +41,7 @@ services: REDIS_URL: redis://shared-redis:6379/0 USE_TIGERBEETLE: false OPERATOR_TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787 - OPERATOR_TENANT_SECRET: 4RRtVErbQqdI9E6o6vOOKuLEbchVvOBvFIXzLWX9GWQ= + API_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964= volumes: - ../private-key.pem:/workspace/private-key.pem depends_on: diff --git a/test/integration/testenv/happy-life-bank/docker-compose.yml b/test/integration/testenv/happy-life-bank/docker-compose.yml index 8986caded5..40fbc64263 100644 --- a/test/integration/testenv/happy-life-bank/docker-compose.yml +++ b/test/integration/testenv/happy-life-bank/docker-compose.yml @@ -39,7 +39,7 @@ services: REDIS_URL: redis://shared-redis:6379/2 USE_TIGERBEETLE: false OPERATOR_TENANT_ID: cf5fd7d3-1eb1-4041-8e43-ba45747e9e5d - OPERATOR_TENANT_SECRET: KQEXlZO65jUJXakXnLxGO7dk387mt71G9tZ42rULSNU= + API_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964= volumes: - ../private-key.pem:/workspace/private-key.pem depends_on: