From 633463a18487ee2058466a06d41a8b049e3df02e Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Fri, 15 Dec 2023 19:18:54 +0000 Subject: [PATCH] :recycle: (gocardless) renamed nordigen_* secrets to gocardless_* --- .../1702667624000-rename-nordigen-secrets.js | 19 +++++++++++++++++++ .../services/gocardless-service.js | 4 ++-- src/app.js | 1 - src/services/secrets-service.js | 4 ++-- upcoming-release-notes/293.md | 6 ++++++ 5 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 migrations/1702667624000-rename-nordigen-secrets.js create mode 100644 upcoming-release-notes/293.md diff --git a/migrations/1702667624000-rename-nordigen-secrets.js b/migrations/1702667624000-rename-nordigen-secrets.js new file mode 100644 index 000000000..df95c8a3d --- /dev/null +++ b/migrations/1702667624000-rename-nordigen-secrets.js @@ -0,0 +1,19 @@ +import getAccountDb from '../src/account-db.js'; + +export const up = async function () { + await getAccountDb().exec( + `UPDATE secrets SET name = "gocardless_secretId" WHERE name = "nordigen_secretId"`, + ); + await getAccountDb().exec( + `UPDATE secrets SET name = "gocardless_secretKey" WHERE name = "nordigen_secretKey" `, + ); +}; + +export const down = async function () { + await getAccountDb().exec( + `UPDATE secrets SET name = "nordigen_secretId" WHERE name = "gocardless_secretId"`, + ); + await getAccountDb().exec( + `UPDATE secrets SET name = "nordigen_secretKey" WHERE name = "gocardless_secretKey" `, + ); +}; diff --git a/src/app-gocardless/services/gocardless-service.js b/src/app-gocardless/services/gocardless-service.js index e7b59a322..263045927 100644 --- a/src/app-gocardless/services/gocardless-service.js +++ b/src/app-gocardless/services/gocardless-service.js @@ -22,8 +22,8 @@ const clients = new Map(); const getGocardlessClient = () => { const secrets = { - secretId: secretsService.get(SecretName.nordigen_secretId), - secretKey: secretsService.get(SecretName.nordigen_secretKey), + secretId: secretsService.get(SecretName.gocardless_secretId), + secretKey: secretsService.get(SecretName.gocardless_secretKey), }; const hash = JSON.stringify(secrets); diff --git a/src/app.js b/src/app.js index 4c20da83d..cf5227585 100644 --- a/src/app.js +++ b/src/app.js @@ -43,7 +43,6 @@ app.use( app.use('/sync', syncApp.handlers); app.use('/account', accountApp.handlers); -app.use('/nordigen', goCardlessApp.handlers); app.use('/gocardless', goCardlessApp.handlers); app.use('/secret', secretApp.handlers); diff --git a/src/services/secrets-service.js b/src/services/secrets-service.js index ee64fc5c4..7794060c6 100644 --- a/src/services/secrets-service.js +++ b/src/services/secrets-service.js @@ -7,8 +7,8 @@ import getAccountDb from '../account-db.js'; * @enum {string} */ export const SecretName = { - nordigen_secretId: 'nordigen_secretId', - nordigen_secretKey: 'nordigen_secretKey', + gocardless_secretId: 'gocardless_secretId', + gocardless_secretKey: 'gocardless_secretKey', }; class SecretsDb { diff --git a/upcoming-release-notes/293.md b/upcoming-release-notes/293.md new file mode 100644 index 000000000..7d835a7ae --- /dev/null +++ b/upcoming-release-notes/293.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MatissJanis] +--- + +migration: rename `nordigen_*` secrets to `gocardless_*`