🐛 Write env encryption key to config if file does not exist #713
This commit is contained in:
@@ -41,8 +41,13 @@ export async function prepareUserSettings(): Promise<IUserSettings> {
|
|||||||
userSettings = {};
|
userSettings = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings and/or key do not exist. So generate a new encryption key
|
if (process.env[ENCRYPTION_KEY_ENV_OVERWRITE] !== undefined) {
|
||||||
userSettings.encryptionKey = randomBytes(24).toString('base64');
|
// Use the encryption key which got set via environment
|
||||||
|
userSettings.encryptionKey = process.env[ENCRYPTION_KEY_ENV_OVERWRITE];
|
||||||
|
} else {
|
||||||
|
// Generate a new encryption key
|
||||||
|
userSettings.encryptionKey = randomBytes(24).toString('base64');
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`UserSettings got generated and saved to: ${settingsPath}`);
|
console.log(`UserSettings got generated and saved to: ${settingsPath}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user