Input: NginxConf (object) Callback: error (string), Config (object)
6731
function parseNginxConf(_config, callback) {
	var _https = findChild('http', _config);
	if (_https.length == 0) {
		callback('Directive not found: http');
		return;
	}

	var _http = _https[0];

	var _upstreams = findChild('upstream', _http);
	if (_upstreams.length == 0) {
		callback('Directive not found: http.upstream');
		return;
	}

	var upstreams = [];

	for (var i = 0, len = _upstreams.length; i < len; i++) {
		var _upstream = _upstreams[i];

		// server is required
		var _servers = findChild('server', _upstream);
		if (_servers.length == 0) {
			callback('Directive not found: http.upstream[' + _upstream.value + '].server');
			return;
		}

		// metadata is optional
		var metadata = parseMetadata(_upstream);

		upstreams.push(
			new Upstream(
				_upstream.value,
				_servers[0].value,
				metadata
			)
		);
	}

	var _servers = findChild('server', _http);
	if (_servers.length == 0) {
		callback('Directive not found: http.server');
		return;
	}

	var _server = _servers[0];

	var root = null;

	var _roots = findChild('root', _server);
	// root is optional
	if (_roots.length > 0) {
		var _root = _roots[0];

		// root metadata is optional
		var metadata = parseMetadata(_root);

		root = new Location('/', metadata);
		root.alias = _root.value;
	}

	var _locations = findChild('location', _server);
	if (_locations.length == 0) {
		callback('Directive not found: http.server.location');
		return;
	}

	var locations = [];

	for (var i = 0, len = _locations.length; i < len; i++) {
		var _location = _locations[i];

		// proxy_pass is optional
		var proxy_pass = ''
		var _proxy_passes = findChild('proxy_pass', _location);
		if (_proxy_passes.length > 0) {
			proxy_pass = _proxy_passes[0].value;
		}

		// alias is optional
		var alias = ''
		var _aliases = findChild('alias', _location);
		if (_aliases.length > 0) {
			alias = _aliases[0].value;
		}

		// rewrite is optional
		var rewrites = [];
		var _rewrites = findChild('rewrite', _location);
		for (var j = 0, lenj = _rewrites.length; j < lenj; j++) {
			rewrites.push(parseRewrite(_rewrites[j].value))
		}

		// content_by_lua is optional
		var lua = '';
		var _luas = findChild('content_by_lua', _location);
		if (_luas.length > 0) {
			lua = _luas[0].value;
		}

		// content_by_lua_file is optional
		var luaFile = '';
		_luaFiles = findChild('content_by_lua_file', _location);
		if (_luaFiles.length > 0) {
			luaFile = _luaFiles[0].value;
		}

		// TODO: handle if blocks

		// metadata is optional
		var metadata = parseMetadata(_location);

		var location = new Location(_location.value, metadata);
		location.proxyPass = proxy_pass;
		location.alias = alias;
		location.rewrites = rewrites;
		location.lua = lua;
		location.luaFile = luaFile;
		locations.push(location);
	}

	var config = new Config()
	config.upstreams = upstreams;
	config.locations = locations;
	config.root = root;

	callback(null, config);
}
1300701
function validate (config) {

	/** Make sure the config object was passed. */
	if (!config) {
		throw new TypeError('Missing configuration object.');
	}

	/** Make sure the panic url is provided. */
	if (typeof config.panic !== 'string') {
		throw new TypeError('Panic server URL "config.panic" not provided.');
	}

	/** Make sure config.clients is an array. */
	if (isArray(config.clients) === false) {
		throw new TypeError('"config.clients" is not an array.');
	}

	var str = JSON.stringify;

	/** Validate the client objects. */
	config.clients.forEach(function (client) {
		if (!client) {
			throw new Error('Client "' + client + '" is not an object.');
		}

		if (!client.type) {
			throw new Error('Missing client.type attribute: ' + str(client));
		}
	});
}
670740
def config(services, raw=false)
      unless [String, Array].include?(services.class)
        raise ArgumentError, "Service(s) argument required"
      end
      
      results       = {}
      names         = [services].flatten.uniq
      
      if names.empty?
        raise ArgumentError, "Service(s) argument required"
      end
      
      key = 'config_' + Digest::MD5.hexdigest(names.to_s) + "_#{raw}"
      
      cache(key) do
        names.each do |service|
          begin
            connection.send_data("config #{service}")
            lines = connection.read_packet 
            results[service] = raw ? lines.join("\n") : parse_config(lines)
          rescue UnknownService, BadExit
            # TODO
          end
        end
        results
      end
    end
181088
def _parse_config(conf, slot=None):
    '''
    
    '''
    ret = cStringIO()
    if isinstance(conf, six.string_types):
        if slot:
            print('{0} {1}'.format(slot, conf), file=ret, end='')
        else:
            print('{0}'.format(conf), file=ret, end='')
    elif isinstance(conf, list):
        is_section = False
        for item in conf:
            if 'this' in item:
                is_section = True
                slot_this = six.text_type(item['this'])
        if is_section:
            print('<{0} {1}>'.format(slot, slot_this), file=ret)
            for item in conf:
                for key, val in item.items():
                    if key != 'this':
                        print(_parse_config(val, six.text_type(key)), file=ret)
            print('</{0}>'.format(slot), file=ret)
        else:
            for value in conf:
                print(_parse_config(value, six.text_type(slot)), file=ret)
    elif isinstance(conf, dict):
        try:
            print('<{0} {1}>'.format(slot, conf['this']), file=ret)
        except KeyError:
            raise SaltException('Apache section container "<{0}>" expects attribute. '
                                'Specify it using key "this".'.format(slot))
        for key, value in six.iteritems(conf):
            if key != 'this':
                if isinstance(value, six.string_types):
                    print('{0} {1}'.format(key, value), file=ret)
                elif isinstance(value, list):
                    print(_parse_config(value, key), file=ret)
                elif isinstance(value, dict):
                    print(_parse_config(value, key), file=ret)
        print('</{0}>'.format(slot), file=ret)

    ret.seek(0)
    return ret.read()
1365438
def _get_config(self, host, port, unix_socket, auth, config_key):
        

        client = self._client(host, port, unix_socket, auth)
        if client is None:
            return None

        config_value = client.config_get(config_key)
        del client
        return config_value
1267543
function vhostof (req, regexp) {
  var host = req.headers.host
  var hostname = hostnameof(req)

  if (!hostname) {
    return
  }

  var match = regexp.exec(hostname)

  if (!match) {
    return
  }

  var obj = Object.create(null)

  obj.host = host
  obj.hostname = hostname
  obj.length = match.length - 1

  for (var i = 1; i < match.length; i++) {
    obj[i - 1] = match[i]
  }

  return obj
}
824408
function setConf(conf, name, value, msg) {
  if (conf[name] && conf[name] !== value) {
    console.warn(
        `Your protractor configuration specifies an option which is overwritten by Bazel: '${name}' ${msg}`);
  }
  conf[name] = value;
}
335835
def validate_config(cls, config):
        
        if "config_file" not in config:
            raise ValueError("No config file path given")
        if "socket_file" not in config:
            raise ValueError("No control socket path given")
        if "pid_file" not in config:
            raise ValueError("No PID file path given")
        if "stats" in config and "port" not in config["stats"]:
            raise ValueError("Stats interface defined, but no port given")
        if "proxies" in config:
            cls.validate_proxies_config(config["proxies"])

        return config
1088825
function checkConfig(config) {
  let requiredProps = ['algorithm', 'format'];
  const errMsg = `Configuration isn't an object with the required properties: ${requiredProps.join(', ')}`;

  if ((!config) || (typeof config !== 'object')) {
    throw new Error(errMsg);
  }

  requiredProps.forEach(p => {
    if (!config[p]) {
      throw new Error(errMsg);
    }
  });
}
73013
function normalizeConfig(config, data) {
  const newConfig = Object.assign({}, data.callback.baseConfig, config)
  const { dest, src, watch } = newConfig
  const errors = []

  if (dest != null && typeof dest !== 'string' && typeof dest !== 'function') {
    errors.push(`- 'dest' must be a string or a function`)
  }

  if (src != null) {
    newConfig.src = toUniqueStrings(newConfig.src)
    if (newConfig.src.length === 0) {
      errors.push(`- 'src' must be a string or an array of strings`)
    }
  }

  if (watch === true) {
    if (Array.isArray(newConfig.src) && newConfig.src.length) {
      newConfig.watch = [].concat(newConfig.src)
    }
  } else if (watch) {
    newConfig.watch = toUniqueStrings(newConfig.watch)
    if (newConfig.watch.length === 0) {
      errors.push(`- 'watch' must be boolean, a string or an array of strings`)
    }
  }

  if (errors.length > 0) {
    const msg = [
      `Invalid config for '${data.name}'`,
      errors.join('\n'),
      JSON.stringify(config, null, 2)
    ].join('\n')
    handleError(new Error(msg), options.strict ? null : data.errors)
    return
  }

  return newConfig
}
1045727
def config(host, seq, option, value):
    """"""
    at(host, 'CONFIG', seq, [str(option), str(value)])
1079789
function readServerConfig( server ) {
  try {
    const severConfig = getConfig( appSeverConfig );
    return Right( Object.assign( server, severConfig ));
  } catch ( e ) {
    print(
      chalk.red( `Failed to read ${SEVER_CONFIG}.` ),
      e.message
    );
    print();
    return Left( null );
  }
}
559891
function main(args, callback) {

  var opts = {};
  Object.keys(options).forEach(key => {
    var opt = options[key];
    if (opt.aliases)
      (opts.alias || (opts.alias = {}))[key] = opt.aliases;
    if (opt.default !== undefined)
      (opts.default || (opts.default = {}))[key] = opt.default;
    if (opt.type === "string")
      (opts.string || (opts.string = [])).push(key);
    else if (opt.type === "boolean")
      (opts.boolean || (opts.boolean = [])).push(key);
  });

  var argv = minimist(args, opts);

  var files = argv._;
  var configFile;

  // prefer specified config file
  if (argv.config)
    configFile = argv.config;

  // otherwise check entry file directory
  else if (files.length)
    if (!fs.existsSync(configFile = path.join(path.dirname(files[0]), "asconfig.json"))) {
      configFile = undefined;
      if (!fs.existsSync(configFile = path.join(path.dirname(files[0]), "tsconfig.json")))
        configFile = undefined;
    }

  // load config file
  if (configFile) {
    try {
      var config = JSON.parse(fs.readFileSync(configFile, "utf8"));
      if (config.assembly)
        config = config.assembly;
      if (config.entryFile) {
        if (!files.length) // prefer command line
          files = [ config.entryFile ];
        delete config.entryFile;
      }
      Object.keys(config).forEach(key => {
        if (options[key] && key !== "config") // prefer command line
          if (options[key].isPath)
            argv[key] = path.isAbsolute(config[key]) ? config[key] : path.join(path.dirname(configFile), config[key]);
          else
            argv[key] = config[key];
      });
    } catch (e) {
      if (!argv.quiet)
        process.stderr.write(chalk.red("\nFailed to load config file: " + e.message + "\n"));
      return callback(EFAILURE);
    }
  }

  // print usage information if requested or no input files have been provided
  if (argv.help || files.length !== 1) {
    (argv.help ? process.stdout : process.stderr).write([
      "Version " + pkg.version + (isDev ? "-dev" + (isOut ? " (out)" : "") : ""),
      "Syntax: "+ chalk.reset.cyan.bold("asc") + " [options] entryFile",
      "",
      chalk.reset.white.bold("Options:"),
      ""
    ].concat(Object.keys(options).map(key => {
      var opt = options[key];
      var cmd = " --" + key;
      if (opt.aliases && opt.aliases.length && opt.aliases[0].length === 1)
        cmd += ", -" + opt.aliases[0];
      while (cmd.length < 18)
        cmd += " ";
      return cmd + "  " + opt.desc.replace(/\n/g, "\n                    ") + "\n";
    })).join("\n").replace(/\[default\]/g, chalk.gray("[default]")));
    return callback(argv.help ? ESUCCESS : EUSAGE);
  }

  // compile to a Binaryen module
  var wasmModule = Compiler.compileFile(files[0], {
    silent: !!argv.quiet,
    target: argv.target,
    noTreeShaking: !!argv.noTreeShaking,
    noImplicitConversion: !!argv.noImplicitConversion,
    noRuntime: !!argv.noRuntime,
    exportRuntime: Array.isArray(argv.exportRuntime) ? argv.exportRuntime
                 : typeof argv.exportRuntime === "string" ? [ argv.exportRuntime ]
                 : undefined
  });

  // bail out if that didn't work
  if (!wasmModule)
    return callback(EFAILURE);

  // from this point on the module must be disposed (finish does this implicitly)

  // optimize the Binaryen module if requested
  if (argv.optimize)
    wasmModule.optimize();

  // validate the Binaryen module if requested
  if (argv.validate) {
    var result = wasmModule.validate(); // FIXME: this always prints to console on error
    if (!result) {
      if (!argv.quiet)
        process.stderr.write(chalk.red("\nValidation failed. See above for details.\n"));
      return finish(Error("validation failed"));
    }
  }

  // default to text format if --outFile references a .wast, .wat or .js and --textFormat isn't specified
  if (argv.outFile && !argv.textFormat) {
    if (/\.wast$/.test(argv.outFile))
      argv.textFormat = "sexpr";
    else if (/\.wat$/.test(argv.outFile))
      argv.textFormat = "linear";
    else if (/\.js$/.test(argv.outfile))
      argv.textFormat = "asmjs";
  }

  // emit to --outFile if specified, otherwise print to stdout
  var output = argv.outFile ? fs.createWriteStream(argv.outFile) : process.stdout;

  // emit text format (textFormat is requested but no textFile has been specified) + asm.js (if applicable)
  if ((argv.textFormat !== undefined || output.isTTY) && !argv.textFile) {
    if (argv.textFormat === "asmjs" || /\.js$/.test(argv.outFile))
      writeAsmjs(wasmModule, output, finish);
    else
      writeText(wasmModule, argv.textFormat, output, maybeWriteAsmjs);

  // emit a binary + text format (if specified) + asm.js (if specified)
  } else
    writeBinary(wasmModule, output, maybeWriteText);

  function maybeWriteText(err) {
    if (err || !argv.textFile)
      return finish(err);
    if (argv.textFormat === "asmjs" || (!argv.textFormat && /\.js$/.test(argv.textFile)))
      writeAsmjs(wasmModule, fs.createWriteStream(argv.textFile), finish);
    else
      writeText(wasmModule, argv.textFormat || /\.wat$/.test(argv.textFile) && "linear" || "sexpr", fs.createWriteStream(argv.textFile), maybeWriteAsmjs);
  }

  function maybeWriteAsmjs(err) {
    if (err || !argv.asmjsFile)
      return finish(err);
    writeAsmjs(wasmModule, fs.createWriteStream(argv.asmjsFile), finish);
  }

  function finish(err) {
    wasmModule.dispose();
    return callback(err ? EFAILURE : ESUCCESS);
  }
}
1330758
function configError(config) {
  if (typeof config !== 'object') { return `the config method must return a config object, got type ${typeof config}`; }
  if (typeof config.entry === 'undefined') { return `No defined entry! 'config.entry' must be defined, got type ${typeof config.entry}.`; }
  if (typeof config.module !== 'object') { return `No defined deployment module! 'config.module' must be an object, got type ${typeof config.module}`; }
  if (typeof config.module.deployment !== 'function') { return `No defined deployment function! 'config.module.deployment' must be type Function (i.e. 'module.deployment = (deploy, contracts, done){}' ), got ${typeof config.module.deployment}`; }
  if (typeof config.module.environment !== 'object') { return `No defined module environment object! 'config.module.environment' must be type Object, got ${typeof config.module.environment}`; }

  const environment = config.module.environment;
  if (typeof environment.provider !== 'object') { return `No defined provider object! 'config.module.environment' must have a defined 'provider' object, got ${typeof environment.provider}`; }
  if (typeof environment.name !== 'string') { return `No defined environment name! 'config.module.environment.name' must be type String, got ${typeof environment.name}`; }

  return null;
}
395813
function Config(conf){
  try{
    if(typeof conf === 'string'){
      this.confPath = conf;
      conf = ini.parse(fs.readFileSync(conf, 'utf8'));
    }
  }catch(e){
    conf = {}
  }
  this.conf= conf || {};
}
9015
function(name, config)
{
    this.mongo    = require('mongodb');
    this.mongoose = require('mongoose');

    this.config = config;
    this.name   = name;

    this.connection = undefined;
    this.orm        = {
        instance : undefined,
        models   : {}
    };
}
645606
function error () {
  if (mocking) {
    cli.stderr += stripAnsi(concatArguments(arguments) + '\n')
  } else {
    console.error.apply(null, arguments)
  }
}