diff options
Diffstat (limited to 'src/Config')
-rw-r--r-- | src/Config/ConfigServiceProvider.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Config/ConfigServiceProvider.php b/src/Config/ConfigServiceProvider.php new file mode 100644 index 00000000..01b648df --- /dev/null +++ b/src/Config/ConfigServiceProvider.php @@ -0,0 +1,26 @@ +<?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 + )); + } + } +} |