Skip to content

Commit

Permalink
Remove .env from Middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Mar 12, 2024
1 parent a37245b commit e841731
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 568 deletions.
40 changes: 0 additions & 40 deletions .env

This file was deleted.

4 changes: 0 additions & 4 deletions .env.test

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/web/app_dev.php
/web/app_test.php
/web/app_dev.php.dist
/config/legacy/parameters.yaml
/config/openconext/parameters.yaml
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
Expand Down
43 changes: 9 additions & 34 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Surfnet\AzureMfa\Infrastructure\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\ErrorHandler\Debug;

if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}

set_time_limit(0);

require dirname(__DIR__).'/vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__).'/config/bootstrap.php';

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}
return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
return new Application($kernel);
};
2 changes: 1 addition & 1 deletion ci/qa/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ cd $(dirname $0)/../../

# PHPUnit Bridge should always be used in Symfony applications. (https://symfony.com/doc/current/components/phpunit_bridge.html)
# This will create a phpunit executable in /bin/ instead of /vendor/bin/
XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration=ci/qa/phpunit.xml --coverage-text --testsuite=unit --stop-on-error $1
./vendor/bin/phpunit --configuration=ci/qa/phpunit.xml --coverage-text --stop-on-error $1
./vendor/bin/phpunit --configuration=ci/qa/phpunit.xml --testsuite=database
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"symfony/mailer": "6.4.*",
"symfony/monolog-bundle": "^v3.9",
"symfony/password-hasher": "6.4.*",
"symfony/runtime": "6.4.*",
"symfony/security-bundle": "6.4.*",
"symfony/translation": "6.4.*",
"symfony/twig-bundle": "6.4.*",
Expand All @@ -69,7 +70,6 @@
"sebastian/phpcpd": "^6.0",
"squizlabs/php_codesniffer": "^3.7",
"symfony/browser-kit": "6.4.*",
"symfony/dotenv": "6.4.*",
"symfony/phpunit-bridge": "^6.4",
"symfony/stopwatch": "6.4.*",
"symfony/web-profiler-bundle": "6.4.*"
Expand Down Expand Up @@ -131,17 +131,16 @@
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-var-dir": "var",
"symfony-bin-dir": "bin",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "config/legacy/parameters.yaml"
"file": "config/openconext/parameters.yaml"
},
"symfony": {
"allow-contrib": false,
"require": "6.4.*"
},
"runtime": {
"disable_dotenv": true
},
"src-dir": "src/Surfnet"
}
}
Loading

0 comments on commit e841731

Please sign in to comment.