-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardize the bootstrapping of the application. Additionally: * Rename APP_ENVIRONMENT to APP_ENV to comply with Symfony's standard. * Enable ACL to remove umask(0000). * Pull latest image before building production images.
- Loading branch information
Showing
10 changed files
with
104 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,16 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace { | ||
|
||
use Gaming\Kernel; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
use Symfony\Component\ErrorHandler\Debug; | ||
|
||
umask(0000); | ||
|
||
set_time_limit(0); | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$input = new ArgvInput(); | ||
$environment = $input->getParameterOption( | ||
['--env', '-e'], | ||
$_SERVER['APP_ENVIRONMENT'] ?? $_ENV['APP_ENVIRONMENT'] ?? 'dev' | ||
); | ||
$isDevelopmentEnvironment = $environment !== 'prod'; | ||
|
||
if ($isDevelopmentEnvironment) { | ||
Debug::enable(); | ||
} | ||
require_once __DIR__ . '/../vendor/autoload_runtime.php'; | ||
|
||
$kernel = new Kernel($environment, $isDevelopmentEnvironment); | ||
$application = new Application($kernel); | ||
$application->run($input); | ||
return static function (array $context): Application { | ||
return new Application(new Kernel($context['APP_ENV'], (bool)$context['APP_DEBUG'])); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace { | ||
|
||
use Gaming\Kernel; | ||
use Symfony\Component\ErrorHandler\Debug; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$environment = $_SERVER['APP_ENVIRONMENT'] ?? $_ENV['APP_ENVIRONMENT'] ?? 'dev'; | ||
$isDevelopmentEnvironment = $environment !== 'prod'; | ||
|
||
if ($isDevelopmentEnvironment) { | ||
Debug::enable(); | ||
} | ||
require_once __DIR__ . '/../vendor/autoload_runtime.php'; | ||
|
||
$kernel = new Kernel($environment, $isDevelopmentEnvironment); | ||
$request = Request::createFromGlobals(); | ||
$response = $kernel->handle($request); | ||
$response->send(); | ||
$kernel->terminate($request, $response); | ||
return static function (array $context): Kernel { | ||
return new Kernel($context['APP_ENV'], (bool)$context['APP_DEBUG']); | ||
}; | ||
} |