Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Separate configs for dev and production
  • Hi guys, I'm curious how everyone else manages their config settings between their dev and production environments. My entire codebase is committed to a git repository. I'm considering using Fabric to help me deploy my config, but I was curious to know if anyone else has a different way of doing it. Basically, there's a good chance that I'll want to keep my dev and production configs different, but at the same time I'd like to keep track of changes made to the configuration. I'm thinking the best way is to ignore them with git, and just use Fabric to push the production config to my server. Thoughts?
  • The usual way is to add an environment variable in the request, e.g. in nginx:
    [url=http://www.contentwithstyle.co.uk/content/zend-framework-with-nginx]fastcgi_param APPLICATION_ENV staging;[/url]
    

    And then simply define a config for each possible value. By default, Fuel has "dev", "test", "qa" and "production". The downside of this method is that people in "dev" have access to the configuration of "production", so what I usually do is to store the production config in a patch which is applied on deployment (and production servers never run from a repository or working copy).
  • I've done it by doing the profiling based on the hostname:
    if ($host ~ \.local$) {
                    set $fuel_env development;
            }
            if ($host ~ \.test$) {
                    set $fuel_env testing;
            }
            if ($host ~ \.com.ar$) {
                    set $fuel_env production;
            }
    

    And then, on the FastCGI params on NGINX
                    fastcgi_param  FUEL_ENV           $fuel_env;
    
  • Config files are merged between app/config and app/config/<environment>, so you can move any config file from app/config to the environment to make them environment specific. Fuel has four environments pre-configured, but you can create any environment you want.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion