Skip to content

Commit

Permalink
chore(backend, localenv): replace OPERATOR_TENANT_SECRET with existin…
Browse files Browse the repository at this point in the history
…g API_SECRET
  • Loading branch information
mkurapov committed Dec 10, 2024
1 parent 17cbcaf commit dab4c15
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion localenv/cloud-nine-wallet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions packages/backend/jest.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -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='
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
`)
}

Expand Down
5 changes: 2 additions & 3 deletions packages/backend/src/config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit dab4c15

Please sign in to comment.