Create a configuration object from a config file.

@param configFile the file that contains the configuration data.
@param configData the config file data
16097
public final Configuration getConfig(final File configFile, final InputStream configData)
            throws IOException {
        final Configuration configuration = this.context.getBean(Configuration.class);
        configuration.setConfigurationFile(configFile);
        MapfishPrintConstructor.setConfigurationUnderConstruction(configuration);

        final Configuration config =
                this.yaml.load(new InputStreamReader(configData, "UTF-8"));
        if (this.doValidation) {
            final List<Throwable> validate = config.validate();
            if (!validate.isEmpty()) {
                StringBuilder errors = new StringBuilder();
                for (Throwable throwable: validate) {
                    errors.append("\n\t* ").append(throwable.getMessage());
                    LOGGER.error("Configuration Error found", throwable);
                }
                throw new Error(errors.toString(), validate.get(0));
            }
        }
        return config;
    }
400819
private void readConfigurationFile(final String configFile) {
    InputStream is;
    try {
      is = new FileInputStream(configFile);
      processConfiguration(MtasConfiguration.readConfiguration(is));
      is.close();
    } catch (FileNotFoundException e) {
      log.error("Couldn't find " + configFile, e);
    } catch (IOException e) {
      log.error("Couldn't read " + configFile, e);
    }
  }
955274
public static function autoConfigure($configFile = null) {
        Maestrano_Config_Client::with('dev-platform')->configure($configFile);
        Maestrano_Config_Client::with('dev-platform')->loadMarketplacesConfig();
    }
612777
def initialize(self, configfile=None):
        

        method = "initialize"

        A = None
        metadata = {method: configfile}

        send_array(self.socket, A, metadata)
        A, metadata = recv_array(
            self.socket, poll=self.poll, poll_timeout=self.poll_timeout,
            flags=self.zmq_flags)
160710
protected function loadConfiguration($configFile = false)
    {
        if ($configFile === false) {
            return;
        }
        echo "\nLoad configuration";

        $configuration = require $configFile;

        foreach ($configuration as $name => $value) {
            if ($this->module->canSetProperty($name) == true) {
                $this->module->$name = $value;
            } else {
                throw new InvalidConfigException("Invalid configuration. Unknown configuration option '{$name}'");
            }
        }
        $this->module->loadComponents();
    }
249140
public static Config loadConfig(ConfigParseOptions parseOptions,
            ConfigResolveOptions resolveOptions, File configFile) {
        return ConfigFactory.parseFile(configFile, parseOptions).resolve(resolveOptions);
    }
683980
public void generateConfig(File configFile, ContainerRoot model) throws IOException {
        StringBuilder buffer = new StringBuilder();
        buffer.append(OSHelper.read(this.getClass().getClassLoader().getResourceAsStream("base.cfg")));
        buffer.append("\n");
        HashMap<String, Backend> backends = new HashMap<String, Backend>();
        for (ContainerNode node : model.getNodes()) {
            for (ComponentInstance instance : node.getComponents()) {
                if (instance.getTypeDefinition().getDictionaryType() != null
                        && instance.getTypeDefinition().getDictionaryType().findAttributesByID("http_port") != null
                        && instance.getStarted()
                        && !instance.getName().equals(context.getInstanceName())) {

                    if (!backends.containsKey(instance.getTypeDefinition().getName())) {
                        Backend backend = new Backend();
                        backends.put(instance.getTypeDefinition().getName(), backend);
                    }
                    Backend backend = backends.get(instance.getTypeDefinition().getName());
                    backend.setName(instance.getTypeDefinition().getName());
                    Server s = new Server();
                    s.setIp("127.0.0.1");
                    s.setName(instance.getName());
                    s.setPort(instance.getDictionary().findValuesByID("http_port").getValue());
                    backend.getServers().add(s);
                }
            }
        }

        if (backends.size() > 0) {
            buffer.append("default_backend ");
            String firstKey = backends.keySet().iterator().next();
            buffer.append(backends.get(firstKey).getName());
            buffer.append("\n");
        }
        for (String key : backends.keySet()) {
            buffer.append("\n");
            buffer.append(backends.get(key));
            buffer.append("\n");
        }
        FileWriter writer = new FileWriter(configFile);
        writer.write(buffer.toString());
        writer.close();
    }
339455
private static Properties load(String configFilePath)
	{
		Properties props = new Properties();
		BufferedInputStream fis = null;
		try {
			File configFile = new File(configFilePath);
	        fis = new BufferedInputStream(new FileInputStream(configFile));
	        props.load(fis);
        }
        catch(IOException e){
        	System.err.println("Could not load configuration file "+configFilePath);
        }
        finally{
			if(fis!=null){
			    try {
					fis.close();
				}
				catch (IOException e) {
		        	System.err.println("Error closing file stream of configuration file "+configFilePath);
				}
			}
        }
        return props;
	}
1135253
public static void writeConfigFile(File configFile, Class<?>[] classes) throws SQLException, IOException {
		writeConfigFile(configFile, classes, false);
	}
722956
public function makeConfig($configFile = [], $requiredConfig = [])
    {
        if (!$configFile) {
            $configFile = [];
        }

        /*
         * Config already made
         */
        if (is_object($configFile)) {
            $config = $configFile;
        }
        /*
         * Embedded config
         */
        elseif (is_array($configFile)) {
            $config = $this->makeConfigFromArray($configFile);
        }
        /*
         * Process config from file contents
         */
        else {

            if (isset($this->controller) && method_exists($this->controller, 'getConfigPath')) {
                $configFile = $this->controller->getConfigPath($configFile);
            }
            else {
                $configFile = $this->getConfigPath($configFile);
            }

            if (!File::isFile($configFile)) {
                throw new SystemException(Lang::get(
                    'system::lang.config.not_found',
                    ['file' => $configFile, 'location' => get_called_class()]
                ));
            }

            $config = Yaml::parse(File::get($configFile));

            /*
             * Extensibility
             */
            $publicFile = File::localToPublic($configFile);
            if ($results = Event::fire('system.extendConfigFile', [$publicFile, $config])) {
                foreach ($results as $result) {
                    if (!is_array($result)) {
                        continue;
                    }
                    $config = array_merge($config, $result);
                }
            }

            $config = $this->makeConfigFromArray($config);
        }

        /*
         * Validate required configuration
         */
        foreach ($requiredConfig as $property) {
            if (!property_exists($config, $property)) {
                throw new SystemException(Lang::get(
                    'system::lang.config.required',
                    ['property' => $property, 'location' => get_called_class()]
                ));
            }
        }

        return $config;
    }
996597
public Properties appendToDefaultProperties(File configFile) {

    if(defaultProperties != null && configFile.canRead()) {

      defaultProperties = appendProperties(defaultProperties, configFile);      
    }

    return defaultProperties;
  }
1306878
public function loadConfig($configFiles)
    {
        if (!is_array($configFiles)) {
            $configFiles = array($configFiles);
        }

        $this->configFiles = $configFiles;

        foreach ($configFiles as $configFile) {
            $this->config = array_merge(
                $this->config,
                $this->loadConfigFile($configFile)
            );
        }
    }
887271
public function createFromData(array $configData) : SettingsContract {
        $data       = (array) Arr::get($configData, 'data', []);
        $rules      = (array) Arr::get($configData, 'rules', []);
        $phrases    = (array) Arr::get($configData, 'phrases', []);
        $customUrl  = (string) Arr::get($configData, 'custom_url', '');

        return new Settings($data, $rules, $phrases, $customUrl);
    }
501830
public OptionsBuilder configurationFile(String configFile) {
		if (configFile != null) {
			options.put(Options.CONFIGURATION_FILE, new File(configFile));
		} else {
			options.remove(Options.CONFIGURATION_FILE);
		}
		return this;
	}
914911
private static List<ConfigFile> createStandaloneConfigFiles(FeaturePack featurePack, ConfigOverride configOverride) {
        final List<org.wildfly.build.common.model.ConfigFile> configFiles = featurePack.getDescription().getConfig().getStandaloneConfigFiles();
        final Map<String, ConfigFileOverride> configFileOverrides = configOverride != null ? configOverride.getStandaloneConfigFiles() : null;
        return createConfigFiles(featurePack.getFeaturePackFile(), configFiles, configOverride, configFileOverrides);
    }
1154289
public function setConfigFile($configFile = '')
    {
        if (!is_readable($configFile)) {
            $this->activeConfig = [];

            throw ParserException::forFileUnreadable($configFile);
        }

        $this->configFile = $configFile;
        if (!$this->parseConfigFile()) {
            throw InvalidConfigException::forEmptyConfig($configFile);
        }

        return $this;
    }
495555
public static void writeConfigFile(File configFile, boolean sortClasses) throws SQLException, IOException {
		writeConfigFile(configFile, new File("."), sortClasses);
	}