From 47c71a62f35a378d4f4435ca4dc87579c22176d0 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 14 Dec 2023 19:58:27 +0200 Subject: [PATCH] Don't rewrite settings if just moving the key --- src/endpoints/secrets.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/endpoints/secrets.js b/src/endpoints/secrets.js index 585bee7ee..5da0cc730 100644 --- a/src/endpoints/secrets.js +++ b/src/endpoints/secrets.js @@ -96,6 +96,13 @@ function readSecretState() { * @returns {void} */ function migrateSecrets(settingsFile) { + const palmKey = readSecret('api_key_palm'); + if (palmKey) { + console.log('Migrating Palm key...'); + writeSecret(SECRET_KEYS.MAKERSUITE, palmKey); + deleteSecret('api_key_palm'); + } + if (!fs.existsSync(settingsFile)) { console.log('Settings file does not exist'); return; @@ -130,14 +137,6 @@ function migrateSecrets(settingsFile) { modified = true; } - const palmKey = readSecret('api_key_palm'); - if (palmKey) { - console.log('Migrating Palm key...'); - writeSecret(SECRET_KEYS.MAKERSUITE, palmKey); - deleteSecret('api_key_palm'); - modified = true; - } - if (modified) { console.log('Writing updated settings.json...'); const settingsContent = JSON.stringify(settings, null, 4);