default APP_ENVRIONMENT to localhost
authorMichael Wallner <mike@php.net>
Fri, 1 May 2015 10:21:39 +0000 (12:21 +0200)
committerMichael Wallner <mike@php.net>
Fri, 1 May 2015 10:21:39 +0000 (12:21 +0200)
app/bootstrap/config.php

index a8fe7bb0da85b2655377fef2e9fc04379f5f8b4a..cbf70d2d80bc843353af6b0b9be05585c6af6671 100644 (file)
@@ -1,15 +1,19 @@
 <?php
 
+namespace app;
+
 use merry\Config;
 
+define("APP_ENVIRONMENT", getenv("APP_ENVIRONMENT") ?: "localhost");
+
 $injector->share(Config::class)
        ->define(Config::class, [
                ":array" => parse_ini_file(__DIR__."/../config.ini", true),
-               ":section" => getenv("APP_ENVIRONMENT")
+               ":section" => APP_ENVIRONMENT
        ])
        ->prepare(Config::class, function(Config $config) {
                $credentials = parse_ini_file(__DIR__."/../credentials.ini", true);
-               foreach (new Config($credentials, getenv("APP_ENVIRONMENT")) as $app => $creds) {
+               foreach (new Config($credentials, APP_ENVIRONMENT) as $app => $creds) {
                        /* one level down should suffice, i.e. $config->github->client = {id,secret,scope} */
                        if ($creds instanceof Config) {
                                foreach ($creds as $key => $val) {