Skip to content

Commit

Permalink
Update settings
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Aug 14, 2022
1 parent 1cbab5d commit ca0ec57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions config/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

$settings = [];

// Environment
$settings['env'] = $_ENV['APP_ENV'] ?? $_SERVER['APP_ENV'] ?? 'dev';

// Error handler
$settings['error'] = [
// Should be set to false for the production environment
Expand Down
8 changes: 7 additions & 1 deletion config/settings.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?php

// Load .env file if located in the project root directory
//(\Dotenv\Dotenv::createImmutable(__DIR__ . '/../'))->safeLoad();

// Define environment
$_ENV['APP_ENV'] = $_ENV['APP_ENV'] ?? $_SERVER['APP_ENV'] ?? 'dev';

// Load default settings
$settings = require __DIR__ . '/defaults.php';

// Overwrite default settings with environment specific local settings
$configFiles = sprintf('%s/{local.%s,env,../../env}.php', __DIR__, $settings['env']);
$configFiles = sprintf('%s/{local.%s,env,../../env}.php', __DIR__, $_ENV['APP_ENV']);

foreach (glob($configFiles, GLOB_BRACE) as $file) {
$local = require $file;
Expand Down

0 comments on commit ca0ec57

Please sign in to comment.