Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
what is the best way to define more config profiles (define custom environments)?
  • we have been working on a project for a while (i think we used fuelphp since its beta version!) and now the project (web app) is being used on multiple servers and even more local machines (multiple platforms) so suddenly PRODUCTION and DEVELOPMENT environments are not enough, so we started to ignore the config folder from GIT but found out this is even worse and config hell exploded in our faces :(

    1. what is the best way to define more config profiles?
    2. can i use Config::load to load a specific file (absolute path) ?
    3. where is the best location to override and load settings? im trying to do it after Fuel::init in bootstrab
    kindly note i dont want to touch the core as this too turned out to be a bad idea when it comes to upgrading and thanks in advance!!

  • ilNotturnoilNotturno
    Accepted Answer
    Hi a7madgamal,
    I had a similar approach and I decided to create a module to load the configurations file. 

    You can insert here your custom configuration and name the configuration file with the site-name and load manually the configuration file in the Base template, if you use this, or in the "before" method of your controller.

    <pre>Config::load('module::custom', 'custom');</pre> 

  • thanks ilNotturno
    however i made a quick hack for now by requiring php files with config::set statements to override settings after Fuel::init call and creating a file just to hold the current profile file name,this way we can add all files to GIT and modify only one variable in one file to select active settings
  • HarroHarro
    Accepted Answer
    I don't think anyone is stopping you from using

    FUEL_ENV=myspecialenv
    or
    \Fuel::$env = "myspecialenv";
    Afaik there is no check in the core code if the environment set is one of the 4 default values configured.
  • the main problem was changing the config files for many setups (some are devs and others are production plus testing..)
    my solution was loading custom configs based on the current url (not very happy about it but its saved us from the pain of updating files by mistake or worse ignoring config files from the GIT repo which was the worst decision ever lol)

Howdy, Stranger!

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

In this Discussion