summaryrefslogtreecommitdiff
path: root/src/Config
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-10-31 13:40:13 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-10-31 13:40:13 +0100
commit60fd72cd1a1e4e53b9af87e00a8c27687c6b5385 (patch)
treebcf250d05a49a848644af44f09fb897467e3ecb0 /src/Config
parentfb05a38a963784716c105e7f214615ad13d2f272 (diff)
Added service providers
Diffstat (limited to 'src/Config')
-rw-r--r--src/Config/ConfigServiceProvider.php26
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
+ ));
+ }
+ }
+}