7 define("APP_ENVIRONMENT", getenv("APP_ENVIRONMENT") ?
: "localhost");
9 $injector->share(Config
::class)
10 ->define(Config
::class, [
11 ":array" => parse_ini_file(__DIR__
."/../config.ini", true),
12 ":section" => APP_ENVIRONMENT
14 ->prepare(Config
::class, function(Config
$config) {
15 $credentials = parse_ini_file(__DIR__
."/../credentials.ini", true);
16 foreach (new Config($credentials, APP_ENVIRONMENT
) as $app => $creds) {
17 /* one level down should suffice, i.e. $config->github->client = {id,secret,scope} */
18 if ($creds instanceof Config
) {
19 foreach ($creds as $key => $val) {
20 $config->$app->$key = $val;
23 $config->$app = $creds;