Skip to content

Commit

Permalink
Merge pull request #648 from tighten/jbk/merge-collection-configs
Browse files Browse the repository at this point in the history
Add option to merge collection configs
  • Loading branch information
damiani authored Sep 2, 2022
2 parents b87509d + e303484 commit a1385be
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Console/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,21 @@ private function includeEnvironmentConfig($env)
$environmentConfigPath = $this->getAbsolutePath("config.{$env}.php");
$environmentConfig = (new ConfigFile($environmentConfigPath))->config;

$this->app->config = $this->app->config
$baseConfig = $this->app->config;

$this->app->config = collect($baseConfig)
->merge(collect($environmentConfig))
->filter(function ($item) {
return $item !== null;
});

if ($this->app->config->get('merge_collection_configs')) {
$this->app->config->put('collections', $this->app->config->get('collections')->map(
function ($envConfig, $key) use ($baseConfig) {
return array_merge($baseConfig->get('collections')->get($key), $envConfig);
}
));
}
}

private function updateBuildPaths($env)
Expand Down

0 comments on commit a1385be

Please sign in to comment.