Welcome Guest, Not a member yet? Register   Sign In
Multiple config.php files
#1

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?
Reply
#2

(This post was last modified: 03-16-2016, 11:18 AM by Russ_AB.)

Use the ENVIRONMENT constant to check.

Something like

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

(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.
Reply
#4

Thanks guys. Both solutions work.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB