3

The Bolt documentation mentions setting up configuration files for each environment, but doesn't explain how to make it happen.

When you have multiple environments for the same site, like development, staging, or production, you’ll want parts of the config to be the same, and some different per environment. You’ll probably have different database info and debug settings. This can be accomplished by splitting the config.yml file. Put all settings you share over all environments in the default config.yml, you can commit this in your version control system if wanted. Every setting which is different per environment, or which you do not want in version control (like database info), you put in config_local.yml. First config.yml is loaded and then config_local.yml, so that config_local.yml can override any setting in config.yml.

Of course I have no problem creating an additional config file, but how do I tell Bolt which environment it's running in and which file it ought to load?

Royall Spence
  • 240
  • 2
  • 9

2 Answers2

3

Turns out Bolt is completely unaware of its environment. It always loads config.yml followed by config_local.yml, regardless of domain name.

From Config.php, starting at line 226:

protected function parseGeneral()
{
    // Read the config and merge it. (note: We use temp variables to prevent
    // "Only variables should be passed by reference")
    $tempconfig = $this->parseConfigYaml('config.yml');
    $tempconfiglocal = $this->parseConfigYaml('config_local.yml');
    $general = Arr::mergeRecursiveDistinct($tempconfig, $tempconfiglocal);

The solution to my problem is to never allow config_local.yml to get deployed.

Royall Spence
  • 240
  • 2
  • 9
2

The config_local.yml file is intended for development use so that you can override configuration setting that might be committed to your VCS in production use.

Gawain
  • 1,568
  • 10
  • 8