Setting bolt configuration to environment

The bolt documentation mentions setting up config files for each environment, but does not explain how.

If you have multiple environments for the same site, such as development, build, or production, you want the parts of the configuration to be the same and some different for each environment. You probably have different database settings and debug settings. This can be accomplished by splitting up the config.yml file. Put all the settings you use in all environments by default to config.yml, you can commit this to your source control if you want. Every parameter that is different from the environment, or that you don't want in source control (such as database information), you insert into config_local.yml. The first config.yml is loaded, followed by config_local.yml, so config_local.yml can override any settings in config.yml.

Of course I have no problem creating an additional config file, but how do I tell Bolt what environment it is running in and which file it should load?

+3


source to share


2 answers


It turns out that Bolt is completely unaware of his surroundings. It always loads config.yml followed by config_local.yml regardless of the 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 deployment.

+3


source


The file is config_local.yml

intended for development use so that you can override configuration settings that may be bound to your VCS during use.



+2


source







All Articles