Skip to content

Commit

Permalink
afup#1442 optimisation du chargement de la configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Mar 7, 2024
1 parent 11390d0 commit 8551dd2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sources/Afup/Utils/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ public function __construct()

private function loadSymfonyParameters(): array
{
$basePath = __DIR__ . '/../../../app/config';
static $parameters = [];

$parameters = [];
$this->mergeSymfonyParametersFromFile($basePath . '/parameters.yml', $parameters);
$this->mergeSymfonyParametersFromFile($basePath . '/config.yml', $parameters);
if (isset($_ENV['SYMFONY_ENV'])) {
$this->mergeSymfonyParametersFromFile($basePath . '/config_' . $_ENV['SYMFONY_ENV'] . '.yml', $parameters);
if ([] === $parameters) {
$basePath = __DIR__ . '/../../../app/config';

$this->mergeSymfonyParametersFromFile($basePath . '/parameters.yml', $parameters);
$this->mergeSymfonyParametersFromFile($basePath . '/config.yml', $parameters);
if (isset($_ENV['SYMFONY_ENV'])) {
$this->mergeSymfonyParametersFromFile($basePath . '/config_' . $_ENV['SYMFONY_ENV'] . '.yml', $parameters);
}
}

return $parameters;
Expand Down

0 comments on commit 8551dd2

Please sign in to comment.