Merging Config Files For Console Apps

How does one go about this? I recently made changes to one of our projects so that the main.php config file would not contain any database settings and instead be merged with a separate, custom config file which will not be pushed to version control. So my index.php file looks something like the following:




// change the following paths if necessary

$yiic = dirname(__FILE__).'/../framework/yiic.php';


// include our config files 

$configMain = include dirname(__FILE__) . '/config/main.php';

$customConfig = include dirname(__FILE__) . '/config/config.custom.php';


// merge config files

$config = CMap::mergeArray($configMain, $customConfig);


require_once($yiic);



Works fine on the web app end, but I can’t figure out how to achieve the same effect with console apps since I can’t seem to use CMap::mergeArray to merge the 2 files (console.log and my custom config file) inside yiic.php

CMap is unknown because the framework (=framework/yii.php) will be included (require_once) inside framework/yiic.php when calling require_once($yiic).

But you can include ‘yii.php’ by yourself before using CMap;




// include the yii framework (maybe as the first line)

require_once(dirname(__FILE__).'/../framework/yii.php');


...


$config = CMap::mergeArray($configMain, $customConfig);


require_once($yiic);