From 2ea05c44b4568c4d20a3a61963ca68a11a92fc77 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 11 May 2021 15:23:03 +0100 Subject: [PATCH] Changing INTERNAL_KEY to INTERNAL_API_KEY. --- hosting/docker-compose.yaml | 4 ++-- hosting/hosting.properties | 2 +- packages/auth/src/environment.js | 2 +- packages/auth/src/middleware/authenticated.js | 2 +- packages/cli/src/hosting/makeEnv.js | 2 +- packages/server/scripts/dev/manage.js | 2 +- packages/server/src/environment.js | 2 +- packages/server/src/utilities/workerRequests.js | 2 +- packages/worker/scripts/dev/manage.js | 2 +- packages/worker/src/environment.js | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml index d04fd7c0e4..00c93ca1c6 100644 --- a/hosting/docker-compose.yaml +++ b/hosting/docker-compose.yaml @@ -16,7 +16,7 @@ services: MINIO_URL: http://minio-service:9000 MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} - INTERNAL_KEY: ${INTERNAL_KEY} + INTERNAL_API_KEY: ${INTERNAL_API_KEY} BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT} PORT: 4002 JWT_SECRET: ${JWT_SECRET} @@ -44,7 +44,7 @@ services: COUCH_DB_USERNAME: ${COUCH_DB_USER} COUCH_DB_PASSWORD: ${COUCH_DB_PASSWORD} COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984 - INTERNAL_KEY: ${INTERNAL_KEY} + INTERNAL_API_KEY: ${INTERNAL_API_KEY} REDIS_URL: redis-service:6379 REDIS_PASSWORD: ${REDIS_PASSWORD} depends_on: diff --git a/hosting/hosting.properties b/hosting/hosting.properties index 6ad962c493..d11972bc4b 100644 --- a/hosting/hosting.properties +++ b/hosting/hosting.properties @@ -9,7 +9,7 @@ MINIO_SECRET_KEY=budibase COUCH_DB_PASSWORD=budibase COUCH_DB_USER=budibase REDIS_PASSWORD=budibase -INTERNAL_KEY=budibase +INTERNAL_API_KEY=budibase # This section contains variables that do not need to be altered under normal circumstances APP_PORT=4002 diff --git a/packages/auth/src/environment.js b/packages/auth/src/environment.js index f582bd118a..a6fe69e5fb 100644 --- a/packages/auth/src/environment.js +++ b/packages/auth/src/environment.js @@ -15,6 +15,6 @@ module.exports = { MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY, MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY, MINIO_URL: process.env.MINIO_URL, - INTERNAL_KEY: process.env.INTERNAL_KEY, + INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, isTest, } diff --git a/packages/auth/src/middleware/authenticated.js b/packages/auth/src/middleware/authenticated.js index 913e7c8cc8..34ed0ec186 100644 --- a/packages/auth/src/middleware/authenticated.js +++ b/packages/auth/src/middleware/authenticated.js @@ -41,7 +41,7 @@ module.exports = (noAuthPatterns = [], opts) => { const authCookie = getCookie(ctx, Cookies.Auth) // this is an internal request, no user made it - if (apiKey && apiKey === env.INTERNAL_KEY) { + if (apiKey && apiKey === env.INTERNAL_API_KEY) { ctx.isAuthenticated = true } else if (authCookie) { try { diff --git a/packages/cli/src/hosting/makeEnv.js b/packages/cli/src/hosting/makeEnv.js index e8c4a8c830..e17e3374dc 100644 --- a/packages/cli/src/hosting/makeEnv.js +++ b/packages/cli/src/hosting/makeEnv.js @@ -18,7 +18,7 @@ MINIO_SECRET_KEY=${randomString.generate()} COUCH_DB_PASSWORD=${randomString.generate()} COUCH_DB_USER=${randomString.generate()} REDIS_PASSWORD=${randomString.generate()} -INTERNAL_KEY=${randomString.generate()} +INTERNAL_API_KEY=${randomString.generate()} # This section contains variables that do not need to be altered under normal circumstances APP_PORT=4002 diff --git a/packages/server/scripts/dev/manage.js b/packages/server/scripts/dev/manage.js index 5349158036..ffd8c6b9e3 100644 --- a/packages/server/scripts/dev/manage.js +++ b/packages/server/scripts/dev/manage.js @@ -39,7 +39,7 @@ async function init() { COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", REDIS_URL: "localhost:6379", WORKER_URL: "http://localhost:4002", - INTERNAL_KEY: "budibase", + INTERNAL_API_KEY: "budibase", JWT_SECRET: "testsecret", REDIS_PASSWORD: "budibase", MINIO_ACCESS_KEY: "budibase", diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 412b05cab0..52c680f65a 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -34,7 +34,7 @@ module.exports = { USE_QUOTAS: process.env.USE_QUOTAS, REDIS_URL: process.env.REDIS_URL, REDIS_PASSWORD: process.env.REDIS_PASSWORD, - INTERNAL_KEY: process.env.INTERNAL_KEY, + INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, // environment NODE_ENV: process.env.NODE_ENV, JEST_WORKER_ID: process.env.JEST_WORKER_ID, diff --git a/packages/server/src/utilities/workerRequests.js b/packages/server/src/utilities/workerRequests.js index b9476f4d24..8922eee957 100644 --- a/packages/server/src/utilities/workerRequests.js +++ b/packages/server/src/utilities/workerRequests.js @@ -42,7 +42,7 @@ exports.sendSmtpEmail = async (to, from, subject, contents) => { request(null, { method: "POST", headers: { - "x-budibase-api-key": env.INTERNAL_KEY, + "x-budibase-api-key": env.INTERNAL_API_KEY, }, body: { email: to, diff --git a/packages/worker/scripts/dev/manage.js b/packages/worker/scripts/dev/manage.js index f2784750c6..f7216befb5 100644 --- a/packages/worker/scripts/dev/manage.js +++ b/packages/worker/scripts/dev/manage.js @@ -8,7 +8,7 @@ async function init() { SELF_HOSTED: 1, PORT: 4002, JWT_SECRET: "testsecret", - INTERNAL_KEY: "budibase", + INTERNAL_API_KEY: "budibase", MINIO_ACCESS_KEY: "budibase", MINIO_SECRET_KEY: "budibase", COUCH_DB_USER: "budibase", diff --git a/packages/worker/src/environment.js b/packages/worker/src/environment.js index dda3e842f1..11eed33982 100644 --- a/packages/worker/src/environment.js +++ b/packages/worker/src/environment.js @@ -28,7 +28,7 @@ module.exports = { SALT_ROUNDS: process.env.SALT_ROUNDS, REDIS_URL: process.env.REDIS_URL, REDIS_PASSWORD: process.env.REDIS_PASSWORD, - INTERNAL_KEY: process.env.INTERNAL_KEY, + INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, /* TODO: to remove - once deployment removed */ COUCH_DB_USERNAME: process.env.COUCH_DB_USERNAME, COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,