Modify config/main.php to facilitate inclusion of extension configs

Hi,

it would be nice, if the default config could be modified like this:


$config = array(

 [...]

);

return $config;



Like described here http://www.yiiframework.com/wiki/52/encapsulate-db-and-module-configurations it would be much more easier to include other configs in an apache-style approach.


$config = array(

 [...]

);


$config = CMap::mergeArray(

	$config,

	require('/path/to/extension-config.php')

	);


return $config;



Best regards,

schmunk

Config is not a part of framework but a part of application. You can build in the way you need.

Hi samdark,

I thought about that, but modifying the templates of config/main.php would also require to subclass WebAppCommand, right?

There’s no way the use “views” like in the frontend of the application, line 62 WebAppCommand:


$sourceDir=realpath(dirname(__FILE__).'/../views/webapp');

For more details why I requested this, please see http://www.yiiframework.com/forum/index.php?/topic/17591-planning-yii-cms-a-different-approach/page__pid__88582#entry88582

I am thinking about a more sophisticated way to merge different config files and I like it much more if this would be handled in config/main.php rather than in the index.php.

What do you think about the framework supporting extension configs, like i.e. Apache does?

But, for sure on one hand config/main.php will be modified for the application, on the other hand, this is just a tiny change ;)

Best regards,

schmunk

I don’t think it’s suitable for all projects since it will slow down execution a bit because of merging. Also there are some ready to use solutions in extensions section.

Could you post a link to the extensions you mentioned?

With a quick look I just found this one: http://www.yiiframework.com/extension/flexibleconfig

http://www.yiiframework.com/extension/yii-environment

Thanks, I will have a look.