Welcome Guest, Not a member yet? Register   Sign In
Getting your environments just RIGHT!
#1

http://www.ignitedcoder.com/codeigniter-environments/

Blog post on separating configs between Development and Production environments. Ya just gotta love CI.

Brendan
Reply
#2

(This post was last modified: 09-01-2015, 05:37 AM by PaulD. Edit Reason: Got the code tags wrong )

That is really interesting.

Up to now, as an example, I would add a dev database to the database config file and just set in the file which one to use.


Code:
e.g. $active_group = 'testing';


For me, that is really powerful because I can run tests with the main site offline on a replica of the actual database, knowing for certain no real data is getting damaged.

I would be interested to hear what others think about your post with more knowledge of CI than me. But thinking about it now, when I move a development site to a live server I never copy over the config or system folders anyway, and for live testing your way isn't any use anyway.

Interesting post though, thank you. Coffee time over, I have to actually go and do some real work now :-)

Best wishes,

Paul.
Reply
#3

As mentioned in the docs, the Config class will load the global config file first, followed by the ENVIRONMENT file. So, if you  call $this->config->load('email') (or just $this->load->library('email')) when you have the following files:
/application/config/email.php
/application/config/production/email.php

It will load /application/config/email.php first, then load the production file, overwriting any duplicated settings with the production values. So, if your production file only includes the settings which need to change for that environment, it doesn't take much effort to figure out what is changing in each environment.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB