CodeIgniter Forums
Multiple config.php files - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Multiple config.php files (/showthread.php?tid=64641)



Multiple config.php files - Wouter60 - 03-16-2016

According to the CI 3.0.4+ documentation, the $config['base_url'] should not be left empty.
In my application/config folder I have two subfolders: development and production.
Each folder has a copy of the config.php file.
Except for the $config['base_url'] setting, both config.php files are identical.
Is it possible to use a shared config.php file in the application/config folder, and make CI also load a config.php file from the right environment subfolder that only contains the base_url setting?


RE: Multiple config.php files - Russ_AB - 03-16-2016

Use the ENVIRONMENT constant to check.

Something like

PHP Code:
$config['base_url'] = (ENVIRONMENT === 'production' 'http://prod' 'http://dev'); 



RE: Multiple config.php files - Narf - 03-16-2016

(03-16-2016, 11:05 AM)Wouter60 Wrote: According to the CI 3.0.4+ documentation, the $config['base_url'] should not be left empty.
In my application/config folder I have two subfolders: development and production.
Each folder has a copy of the config.php file.
Except for the $config['base_url'] setting, both config.php files are identical.
Is it possible to use a shared config.php file in the application/config folder, and make CI also load a config.php file from the right environment subfolder that only contains the base_url setting?

Yes, all config files work like this.


RE: Multiple config.php files - Wouter60 - 03-16-2016

Thanks guys. Both solutions work.