Skip to content

Commit

Permalink
Merge pull request #13 from buinguyenkhoa/master
Browse files Browse the repository at this point in the history
Allow user to place config file in their own folder
  • Loading branch information
alfallouji committed Jul 7, 2015
2 parents 2387e52 + 3e47bad commit f2cb759
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
require_once(DHL_API_DIR . 'vendor/autoloadManager/autoloadManager.php');

// Load adequate configuration file based on the APPLICATION_ENVIRONMENT
if ($applicationEnvironment = getenv('APPLICATION_ENVIRONMENT'))
if ($applicationEnvironment = getenv('APPLICATION_ENVIRONMENT'))
{
$configFilename = 'config-' . $applicationEnvironment . '.php';
}
Expand All @@ -37,7 +37,12 @@
$configFilename = 'config.php';
}

$config = require(DHL_API_DIR . 'conf/' . $configFilename);
//Allow to place the config file anywhere in project
if (! defined('DHL_CONF_API_DIR')) {
define('DHL_CONF_API_DIR', __DIR__ . '/');
}

$config = require(DHL_CONF_API_DIR . 'conf/' . $configFilename);
$scanOption = isset($config['autoloader']['scanOption']) ? $config['autoloader']['scanOption'] : autoloadManager::SCAN_ONCE;
$autoloadDir = isset($config['autoloader']['dir']) ? $config['autoloader']['dir'] : sys_get_temp_dir() . '/dhl-api-autoload.php';

Expand Down

0 comments on commit f2cb759

Please sign in to comment.