fixed configs for portable installations

This commit is contained in:
antelle 2020-05-22 20:54:47 +02:00
parent b9f37c22d9
commit ccce95d4fe
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
1 changed files with 9 additions and 7 deletions

View File

@ -823,14 +823,16 @@ function saveConfig(name, data, key) {
data = Buffer.from(data);
const crypto = require('crypto');
const cipher = crypto.createCipheriv(
'aes-256-cbc',
key.slice(0, 32),
key.slice(32, 48)
);
if (configEncryptionKey) {
const crypto = require('crypto');
const cipher = crypto.createCipheriv(
'aes-256-cbc',
key.slice(0, 32),
key.slice(32, 48)
);
data = Buffer.concat([cipher.update(data), cipher.final()]);
data = Buffer.concat([cipher.update(data), cipher.final()]);
}
} catch (err) {
return reject(`Error writing config data ${name}: ${err}`);
}