Merge conf into ENV

@param {String} env
@param {Object} conf
@param {String} key
@param {Object} ENV
@param {Function} fn
505165
function mergeConf(env, conf, key, ENV, fn) {
  fetch(conf, key, function(err, layout) {
    if (err) return fn(err);

    fetch(layout, 'default', function(err, defaults) {
      if (err) return fn(err);

      debug('  default', defaults);
      merge(ENV, defaults);
      debug('    ', ENV);

      fetch(layout, env, function(err, envs) {
        if (err) return fn(err);

        debug('  ' + env, envs);
        merge(ENV, envs);
        debug('    ', ENV);

        fn();
      });
    });
  });
}
647664
function (data, isMerge) {
        if (isMerge === true) {
            deepMerge(conf, data);
        } else {
            conf = JSON.parse(JSON.stringify(data || {}))
        }
    }
786932
function _configFilter ( f ) {
        var parts = f.split("."),
            ext = parts[ parts.length - 1 ],
            pre = parts[ parts.length - 2 ],
            name = parts[ parts.length - 3];

        return !!(ext === "dist" && pre === "json" &&
                    exports.__ignores.indexOf( name ) === -1 && exports.__ignores.indexOf( f ) === -1 );
    }
1369423
function merge (target, source) {
  if (isMergeable(source)) {
    var keys = Object.keys(source);
    for (var i = 0; i < keys.length; i++) {
      var key = keys[i];
      var sourceSetting = source[key];
      var targetSetting = target[key];

      if (isMergeable(sourceSetting)) {
        // It's a nested object, so merge it recursively
        target[key] = merge(targetSetting || {}, sourceSetting);
      }
      else if (sourceSetting !== undefined) {
        // It's a scalar value, function, or array. No merging necessary. Just overwrite the target value.
        target[key] = sourceSetting;
      }
    }
  }
  return target;
}
1085025
function(env) {

			var envConfig = this.createEmptyConfig();

			if (env) {

				envConfig.env = env;

				Object.keys(env).filter(function(name) {
					return env[name];
				}).forEach(function(name) {
					var environment = Environments.name;

					if (environment) {
						if (environment.globals) {
							assign(envConfig.globals, environment.globals);
						}

						if (environment.parserOptions) {
							assign(envConfig.parserOptions, environment.parserOptions);
						}
					}
				});
			}

			return envConfig;
		}
230950
function merge_config(top_config, base_config)
{
    for (var option in top_config)
    {
        if (Array.isArray(top_config[option])) // handle array elements in the same order
        {
            if (!Array.isArray(base_config[option]))
                base_config[option] = top_config[option];
            else
            {
                for(var i=0;i<top_config[option].length;i++)
                {
                    if (base_config[option].length <= i)
                        base_config[option].push(top_config[option][i]);
                    else
                        merge_config(top_config[option][i],base_config[option][i]);
                }
            } 
        }
        else if (typeof top_config[option] === "Object") // recurseively handle complex configurations
        {
            if (base_config[option] === undefined)
                base_config[option] = top_config[option];
            else
                merge_config(top_config[option], base_config[option]);
        }
        else
            base_config[option] = top_config[option];
    }

}
1154578
def set_main(key, value, path=MAIN_CF):
    '''
    
    '''
    pairs, conf_list = _parse_main(path)

    new_conf = []
    key_line_match = re.compile("^{0}([\\s=]|$)".format(re.escape(key)))
    if key in pairs:
        for line in conf_list:
            if re.match(key_line_match, line):
                new_conf.append('{0} = {1}'.format(key, value))
            else:
                new_conf.append(line)
    else:
        conf_list.append('{0} = {1}'.format(key, value))
        new_conf = conf_list

    _write_conf(new_conf, path)
    return new_conf
82372
public static function mergeConfig($key, $config)
    {
        $values = Hash::merge((array) Configure::read($key), $config);
        Configure::write($key, $values);

        return $values;
    }
1307973
function envPlugin(dynamicConfig, options) {
    var self = this;
    var separator;
    var whitelist;

    if (options && typeof options === "object") {
        separator = options.separator;
        whitelist = options.whitelist;
    }

    this(dynamicConfig).after("loadConfigFile", function (result) {
        self.override.result = merge(result, process.env, separator, whitelist);
    });
}
1290355
protected static function mergeConfiguredEmails($config, $env)
    {
        // Normalise config list
        $normalised = [];
        $source = (array)static::config()->get($config);
        foreach ($source as $address => $name) {
            if ($address && !is_numeric($address)) {
                $normalised[$address] = $name;
            } elseif ($name) {
                $normalised[$name] = null;
            }
        }
        $extra = Environment::getEnv($env);
        if ($extra) {
            $normalised[$extra] = null;
        }
        return $normalised;
    }
770562
function conform(src, conf) {
  var dest = {};

  var rec = function(dest, src, conf) {
    Object.keys(conf).forEach(function(key) {
      if((typeof conf[key] === 'object' && !Array.isArray(conf[key]))) {
        dest[key] = rec({}, src[key] || {}, conf[key]);
      } else if(typeof conf[key] === 'object' && Array.isArray(conf[key])) {
        dest[key] = conf[key];
      } else {
        if(Object.prototype.hasOwnProperty.call(src, key)) {
          dest[key] = src[key];
        } else {
          dest[key] = src[key] || conf[key];
        }
      }
    });

    return dest;
  };

  return rec(dest, src, conf);
}
1360160
function mergeConfiguration(options, defaults) {
    var config = {};
    var local = {};
    var localPath = options.__localPath || '/data/local.js';
    var reallyLocalPath = self.rootDir + localPath;

    if (fs.existsSync(reallyLocalPath)) {
      local = require(reallyLocalPath);
    }

    // Otherwise making a second apos instance
    // uses the same modified defaults object

    config = _.cloneDeep(options.__testDefaults || defaults);

    _.merge(config, options);

    if (typeof (local) === 'function') {
      if (local.length === 1) {
        _.merge(config, local(self));
      } else if (local.length === 2) {
        local(self, config);
      } else {
        throw new Error('data/local.js may export an object, a function that takes apos as an argument and returns an object, OR a function that takes apos and config as objects and directly modifies config');
      }
    } else {
      _.merge(config, local || {});
    }

    return config;
  }
1270061
function setEnv(env) {
  home.initHomeDir();
  const envFile = path.join(home.getHomePath(), FILE_ENV);
  const envData = {
    env,
  };
  debug('set fie env data : %o', envData);
  debug('set fie to : %s', envFile);
  cacheEnv = null;
  fs.outputJsonSync(envFile, envData);
}
205302
function mergeConfig(loaderConfig) {
  var defaultConfig = {
    // Web3
    provider: 'http://localhost:8545',

    // For deployment
    from: web3.eth.accounts[0],
    gasLimit: web3.eth.getBlock(web3.eth.defaultBlock).gasLimit,

    // Specify contract constructor parameters, if any.
    // constructorParams: {
    //   ContractOne: [ 'param1_value', 'param2_value' ]
    // }
    constructorParams: {},

    // To use deployed contracts instead of redeploying, include contract addresses in config
    // deployedContracts: {
    //   ContractOne: '0x...........',
    //   ContractTwo: '0x...........',
    // }
    deployedContracts: {}
  };

  var mergedConfig = loaderConfig;
  for (var key in defaultConfig) {
    if (!mergedConfig.hasOwnProperty(key)) {
      mergedConfig[key] = defaultConfig[key];
    }
  }
  return mergedConfig;
}
425670
function setConfig(newConf, isClearPrevious) {
    checkIsObject(newConf);
    config = isClearPrevious ? Immutable.fromJS(newConf) : config.merge(newConf);
}
97589
function merge (target, source) {
  source = source || {};
  return Object.keys(source).reduce((targetKey, key) => {
    targetKey[key] = source[key];
    return target;
  }, target);
}
580319
function env(environment) {
  environment = environment || {};

  if ('object' === typeof process && 'object' === typeof process.env) {
    env.merge(environment, process.env);
  }

  if ('undefined' !== typeof window) {
    if ('string' === window.name && window.name.length) {
      env.merge(environment, env.parse(window.name));
    }

    if (window.localStorage) {
      try { env.merge(environment, env.parse(window.localStorage.env || window.localStorage.debug)); }
      catch (e) {}
    }

    if (
         'object' === typeof window.location
      && 'string' === typeof window.location.hash
      && window.location.hash.length
    ) {
      env.merge(environment, env.parse(window.location.hash.charAt(0) === '#'
        ? window.location.hash.slice(1)
        : window.location.hash
      ));
    }
  }

  //
  // Also add lower case variants to the object for easy access.
  //
  var key, lower;
  for (key in environment) {
    lower = key.toLowerCase();

    if (!(lower in environment)) {
      environment[lower] = environment[key];
    }
  }

  return environment;
}