chg: [config:bootstrap] Only get file content if config.json exists

cli-modification-summary
Sami Mokaddem 2022-06-08 12:00:48 +02:00
parent fa68d62890
commit 2859977756
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 8 additions and 4 deletions

View File

@ -37,6 +37,7 @@ use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Datasource\ConnectionManager;
use Cake\Error\ConsoleErrorHandler;
use Cake\Error\ErrorHandler;
use Cake\Filesystem\File;
use Cake\Http\ServerRequest;
use Cake\Log\Log;
use Cake\Mailer\Mailer;
@ -88,12 +89,15 @@ try {
if (file_exists(CONFIG . 'app_local.php')) {
Configure::load('app_local', 'default');
//Configure::load('cerebrate', 'default', true);
$settingsFile = new File(CONFIG . 'config.json');
if ($settingsFile->exists()) {
$settings = file_get_contents(CONFIG . 'config.json');
$settings = json_decode($settings, true);
foreach ($settings as $path => $setting) {
Configure::write($path, $setting);
}
}
}
/*
* When debug = true the metadata cache should only last