diff --git a/react/features/base/config/functions.js b/react/features/base/config/functions.js index e2c615ec1..7f562acb4 100644 --- a/react/features/base/config/functions.js +++ b/react/features/base/config/functions.js @@ -1,6 +1,7 @@ /* @flow */ import JSSHA from 'jssha'; +import _ from 'lodash'; import parseURLParams from './parseURLParams'; @@ -172,17 +173,11 @@ export function overrideConfigJSON( if (configObj) { const configJSON = json[configName]; - for (const key of Object.keys(configJSON)) { - const oldValue = configObj[key]; - const newValue = configJSON[key]; - - if (oldValue && typeof oldValue !== typeof newValue) { - logger.log( - `Overriding a ${configName - } property with a property of different type.`); - } - logger.info(`Overriding ${key} with: ${newValue}`); - configObj[key] = newValue; + if (!_.isEmpty(configJSON)) { + logger.info( + `Extending ${configName} ` + + `with: ${JSON.stringify(configJSON)}`); + _.merge(configObj, configJSON); } } } @@ -227,20 +222,21 @@ export function setConfigFromURLParams() { loggingConfig && (json.loggingConfig = {}); for (const param of Object.keys(params)) { - const objEnd = param.indexOf('.'); + let base = json; + const names = param.split('.'); + const last = names.pop(); - if (objEnd !== -1) { - const obj = param.substring(0, objEnd); - - if (json.hasOwnProperty(obj)) { - const key = param.substring(objEnd + 1); - - // Prevent passing some parameters which can inject scripts. - if (key && _KEYS_TO_IGNORE.indexOf(key) === -1) { - json[obj][key] = params[param]; - } - } + // Prevent passing some parameters which can inject scripts. + if (_KEYS_TO_IGNORE.indexOf(last) !== -1) { + // eslint-disable-next-line no-continue + continue; } + + for (const name of names) { + base = base[name] = base[name] || {}; + } + + base[last] = params[param]; } overrideConfigJSON(config, interfaceConfig, loggingConfig, json);