123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- const logger = require("jitsi-meet-logger").getLogger(__filename);
-
- var ConfigUtil = {
- /**
- * Method overrides JSON properties in <tt>config</tt> and
- * <tt>interfaceConfig</tt> Objects with the values from <tt>newConfig</tt>
- * @param config the config object for which we'll be overriding properties
- * @param interfaceConfig the interfaceConfig object for which we'll be
- * overriding properties.
- * @param loggingConfig the logging config object for which we'll be
- * overriding properties.
- * @param newConfig object containing configuration properties. Destination
- * object is selected based on root property name:
- * {
- * config: {
- * // config.js properties to be
- * },
- * interfaceConfig: {
- * // interface_config.js properties here
- * },
- * loggingConfig: {
- * // logging_config.js properties here
- * }
- * }
- */
- overrideConfigJSON: function (config,
- interfaceConfig, loggingConfig, newConfig) {
- var configRoot, key, value, confObj;
- for (configRoot in newConfig) {
- confObj = null;
- if (configRoot == "config") {
- confObj = config;
- } else if (configRoot == "interfaceConfig") {
- confObj = interfaceConfig;
- } else if (configRoot == "loggingConfig") {
- confObj = loggingConfig;
- } else {
- continue;
- }
-
- for (key in newConfig[configRoot]) {
- value = newConfig[configRoot][key];
- if (confObj[key] && typeof confObj[key] !== typeof value) {
- logger.log("Overriding a " + configRoot +
- " property with a property of different type.");
- }
- logger.info("Overriding " + key + " with: " + value);
- confObj[key] = value;
- }
- }
- }
- };
-
- module.exports = ConfigUtil;
|