private function loadConfigFile($homeDir, Config $baseConfig)
{
if (null === $homeDir) {
return null;
}
Assert::fileExists($homeDir, 'Could not load Puli context: The home directory %s does not exist.');
Assert::directory($homeDir, 'Could not load Puli context: The home directory %s is a file. Expected a directory.');
// Create a storage without the factory manager
$jsonStorage = new JsonStorage($this->getStorage(), new JsonConverterProvider($this), $this->getJsonEncoder(), $this->getJsonDecoder());
$configPath = Path::canonicalize($homeDir) . '/config.json';
try {
return $jsonStorage->loadConfigFile($configPath, $baseConfig);
} catch (FileNotFoundException $e) {
// It's ok if no config.json exists. We'll work with
// DefaultConfig instead
return null;
}
}