engelsystem/src/Config/ConfigServiceProvider.php

27 lines
635 B
PHP
Raw Normal View History

2017-10-31 13:40:13 +01:00
<?php
namespace Engelsystem\Config;
use Engelsystem\Container\ServiceProvider;
class ConfigServiceProvider extends ServiceProvider
{
public function register()
{
$defaultConfigFile = config_path('config.default.php');
$configFile = config_path('config.php');
$config = $this->app->make(Config::class);
$this->app->instance('config', $config);
$config->set(require $defaultConfigFile);
if (file_exists($configFile)) {
$config->set(array_replace_recursive(
$config->get(null),
require $configFile
));
}
}
}