Don't rewrite settings if just moving the key

This commit is contained in:
Cohee 2023-12-14 19:58:27 +02:00
parent a6bb754567
commit 47c71a62f3
1 changed files with 7 additions and 8 deletions

View File

@ -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);