2018-01-30 03:16:39 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Bootstrap;
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Config\Repository as RepositoryContract;
|
2018-02-21 12:33:09 +08:00
|
|
|
use Illuminate\Contracts\Foundation\Application;
|
2018-01-30 03:16:39 +08:00
|
|
|
|
|
|
|
class LoadConfiguration extends \Illuminate\Foundation\Bootstrap\LoadConfiguration
|
|
|
|
{
|
|
|
|
/**
|
2020-02-09 02:29:34 +08:00
|
|
|
* Load the configuration items from all of the files. This reads the config.php from
|
|
|
|
* that's sitting in the root, and then recursively merges it with the current configs
|
2018-01-30 03:16:39 +08:00
|
|
|
*
|
2018-08-27 00:40:04 +08:00
|
|
|
* @param \Illuminate\Contracts\Foundation\Application $app
|
|
|
|
* @param \Illuminate\Contracts\Config\Repository $repository
|
|
|
|
*
|
2018-01-30 03:16:39 +08:00
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
|
|
|
|
{
|
|
|
|
parent::loadConfigurationFiles($app, $repository);
|
|
|
|
|
2018-08-27 00:40:04 +08:00
|
|
|
/*
|
2018-01-30 03:16:39 +08:00
|
|
|
* Read in the base config, only if it exists
|
|
|
|
*/
|
|
|
|
if (file_exists($app->basePath().'/config.php')) {
|
|
|
|
$local_conf = include $app->basePath().'/config.php';
|
|
|
|
foreach ($local_conf as $namespace => $override_config) {
|
|
|
|
$config = $repository->get($namespace, []);
|
|
|
|
$update_config = array_replace_recursive($config, $override_config);
|
|
|
|
$repository->set($namespace, $update_config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|