protected function loadConfig()
{
$rootConfigPath = false;
foreach ((array) $this['config.file'] as $file) {
$rootConfigPath = ConfigFile::findConfigFile($file, getcwd());
if (false !== $rootConfigPath) {
break;
}
}
if (false === $rootConfigPath) {
$this['log']->err(sprintf("Filesystem boundary reached, none of %s found.\n", json_encode((array) $this['config.file'])));
return false;
}
$this->loadConfigFile($rootConfigPath);
# Save the original working directory, the working directory
# gets set to the project directory while running tasks.
$this->originalDirectory = getcwd();
# The project dir is the directory of the root config.
$this->projectDirectory = dirname($rootConfigPath);
# Search for additional configs in the config load paths
$configLoadPath = array_filter($this['config.load_path'], 'is_dir');
if ($configLoadPath) {
$cwd = getcwd();
chdir($this->projectDirectory);
$finder = Finder::create()->files()->name("*.php")->in($configLoadPath);
foreach ($finder as $file) {
$this->loadConfigFile($file);
}
chdir($cwd);
}
return true;
}