fix(core): Create instance settings directory recursively (no-changelog) (#7506)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-10-24 15:10:22 +02:00
committed by GitHub
parent a739245332
commit 8ff9f97493
2 changed files with 19 additions and 14 deletions

View File

@@ -63,10 +63,11 @@ export class InstanceSettings {
errorMessage: `Error parsing n8n-config file "${settingsFile}". It does not seem to be valid JSON.`,
});
} else {
// Ensure that the `.n8n` folder exists
mkdirSync(this.n8nFolder, { recursive: true });
// If file doesn't exist, create new settings
const encryptionKey = process.env.N8N_ENCRYPTION_KEY ?? randomBytes(24).toString('base64');
settings = { encryptionKey };
mkdirSync(path.dirname(settingsFile));
this.save(settings);
// console.info(`UserSettings were generated and saved to: ${settingsFile}`);
}