mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2026-08-13 12:33:07 +02:00
Add defensive guards for multi-node config updates
This commit is contained in:
parent
18a40ed183
commit
a11179085b
4 changed files with 6 additions and 2 deletions
|
|
@ -254,7 +254,7 @@ export const updateApplicationSettings = (req, res, next) => {
|
|||
try {
|
||||
const oldConfig = JSON.parse(fs.readFileSync(RTLConfFile, 'utf-8'));
|
||||
const config = common.addSecureData(JSON.parse(JSON.stringify(req.body)));
|
||||
const runtimeConfig = JSON.parse(JSON.stringify(oldConfig));
|
||||
const runtimeConfig = oldConfig;
|
||||
Object.keys(config).forEach((key) => {
|
||||
if (key !== 'nodes') {
|
||||
runtimeConfig[key] = config[key];
|
||||
|
|
@ -298,6 +298,7 @@ export const updateApplicationSettings = (req, res, next) => {
|
|||
delete fileConfig.allowPasswordUpdate;
|
||||
delete fileConfig.rtlConfFilePath;
|
||||
delete fileConfig.rtlPass;
|
||||
delete fileConfig.multiPass;
|
||||
fileConfig.nodes?.forEach((node) => {
|
||||
delete node.authentication?.options;
|
||||
delete node.authentication?.runeValue;
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ export class CommonService {
|
|||
config.nodes?.forEach((node) => {
|
||||
const appConfigNode = appConfigNodes.get(node.index);
|
||||
if (appConfigNode?.authentication) {
|
||||
node.authentication = node.authentication || {};
|
||||
if (appConfigNode.authentication.macaroonPath) {
|
||||
node.authentication.macaroonPath = appConfigNode.authentication.macaroonPath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ export const updateApplicationSettings = (req, res, next) => {
|
|||
try {
|
||||
const oldConfig = JSON.parse(fs.readFileSync(RTLConfFile, 'utf-8'));
|
||||
const config = common.addSecureData(JSON.parse(JSON.stringify(req.body)));
|
||||
const runtimeConfig = JSON.parse(JSON.stringify(oldConfig));
|
||||
const runtimeConfig = oldConfig;
|
||||
Object.keys(config).forEach((key) => {
|
||||
if (key !== 'nodes') {
|
||||
runtimeConfig[key] = config[key];
|
||||
|
|
@ -298,6 +298,7 @@ export const updateApplicationSettings = (req, res, next) => {
|
|||
delete fileConfig.allowPasswordUpdate;
|
||||
delete fileConfig.rtlConfFilePath;
|
||||
delete fileConfig.rtlPass;
|
||||
delete fileConfig.multiPass;
|
||||
fileConfig.nodes?.forEach((node) => {
|
||||
delete node.authentication?.options;
|
||||
delete node.authentication?.runeValue;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ export class CommonService {
|
|||
config.nodes?.forEach((node) => {
|
||||
const appConfigNode = appConfigNodes.get(node.index);
|
||||
if (appConfigNode?.authentication) {
|
||||
node.authentication = node.authentication || {};
|
||||
if (appConfigNode.authentication.macaroonPath) {
|
||||
node.authentication.macaroonPath = appConfigNode.authentication.macaroonPath;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue