Skip to content

Commit 9e4be91

Browse files
authored
Refactor de SYMFONY_ENV en APP_ENV (#2052)
1 parent b80cc02 commit 9e4be91

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ test-functional: data config htdocs/uploads tmp
106106
$(DOCKER_COMP) stop dbtest apachephptest mailcatcher
107107
$(DOCKER_COMP) up -d dbtest apachephptest mailcatcher
108108
make clean-test-deprecated-log
109-
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephp ./bin/behat
109+
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephptest ./bin/behat
110110
make var/logs/test.deprecations_grouped.log
111111
$(DOCKER_COMP) stop dbtest apachephptest mailcatcher
112112

113113
### Tests d'intégration avec start/stop des images docker
114114
test-integration-ci:
115115
$(DOCKER_COMP) stop dbtest apachephptest
116116
$(DOCKER_COMP) up -d dbtest apachephptest
117-
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephp make vendor
118-
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephp ./bin/phpunit --testsuite integration
117+
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephptest make vendor
118+
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephptest ./bin/phpunit --testsuite integration
119119
$(DOCKER_COMP) stop dbtest apachephptest
120120

121121
### Analyse PHPStan

bin/console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set_time_limit(0);
1515
$loader = require __DIR__.'/../vendor/autoload.php';
1616

1717
$input = new ArgvInput();
18-
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
18+
$env = $input->getParameterOption(['--env', '-e'], getenv('APP_ENV') ?: 'dev');
1919
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
2020

2121
$kernel = new AppKernel($env, $debug);

compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ services:
3232
gid: "1001"
3333
ENABLE_XDEBUG: ${ENABLE_XDEBUG:-false}
3434
environment:
35-
SYMFONY_ENV: "dev"
35+
APP_ENV: "dev"
3636
HOST_PWD: ${PWD}
3737
SYMFONY_IDE: "%env(IDE_USED)%://open?url=file://%%f&line=%%l&/var/www/html/>%env(HOST_PWD)%/"
3838
env_file:
@@ -51,7 +51,7 @@ services:
5151
gid: "1001"
5252
ENABLE_XDEBUG: ${ENABLE_XDEBUG:-false}
5353
environment:
54-
SYMFONY_ENV: "test"
54+
APP_ENV: "test"
5555
HOST_PWD: ${PWD}
5656
SYMFONY_IDE: "%env(IDE_USED)%://open?url=file://%%f&line=%%l&/var/www/html/>%env(HOST_PWD)%/"
5757
env_file:

htdocs/app.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use Composer\Autoload\ClassLoader;
77
use Symfony\Component\HttpFoundation\Request;
88

9-
$isDevEnv = isset($_ENV['SYMFONY_ENV']) && $_ENV['SYMFONY_ENV'] == 'dev';
10-
$isTestEnv = isset($_ENV['SYMFONY_ENV']) && $_ENV['SYMFONY_ENV'] == 'test';
9+
$isDevEnv = isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'dev';
10+
$isTestEnv = isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'test';
1111

1212
if ($_SERVER['HTTP_HOST'] === 'afup.dev' || $isDevEnv || $isTestEnv) {
1313
if (!$isDevEnv && !$isTestEnv

sources/Afup/Bootstrap/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
// mise à jour des paramétrages PHP en fonction de la configuration
3636

37-
if (getenv('SYMFONY_ENV') === 'prod') {
37+
if (getenv('APP_ENV') === 'prod') {
3838
ini_set('error_reporting', (string) (E_ALL ^ E_WARNING ^ E_NOTICE));
3939
ini_set('display_errors', '0');
4040
} else {

sources/Afup/Utils/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ private function loadSymfonyParameters(): array
4444
$parameters = [];
4545
$basePath = __DIR__ . '/../../../app/config';
4646

47-
if (isset($_ENV['SYMFONY_ENV'])) {
48-
$file = $basePath . '/config_' . $_ENV['SYMFONY_ENV'] . '.yml';
47+
if (isset($_ENV['APP_ENV'])) {
48+
$file = $basePath . '/config_' . $_ENV['APP_ENV'] . '.yml';
4949
if (is_file($file)) {
5050
$values = Yaml::parseFile($file);
5151
if (isset($values['parameters'])) {

sources/Afup/Utils/SymfonyKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public function __construct(Request $request = null)
2020
$env = 'prod';
2121
$debug = false;
2222

23-
if (isset($_ENV['SYMFONY_ENV']) && $_ENV['SYMFONY_ENV'] === 'dev') {
23+
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] === 'dev') {
2424
$debug = true;
2525
$env = 'dev';
2626
}
2727

28-
if (isset($_ENV['SYMFONY_ENV']) && $_ENV['SYMFONY_ENV'] === 'test') {
28+
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] === 'test') {
2929
$env = 'test';
3030
}
3131

0 commit comments

Comments
 (0)