parent
d577510355
commit
3d2290c194
|
@ -2,22 +2,29 @@
|
||||||
|
|
||||||
use Symfony\Component\Dotenv\Dotenv;
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
|
|
||||||
require dirname(__DIR__).'/vendor/autoload.php';
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
if (!class_exists(Dotenv::class)) {
|
if (!class_exists(Dotenv::class)) {
|
||||||
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
|
throw new LogicException(
|
||||||
|
'Please run "composer require symfony/dotenv" to load the ".env" files
|
||||||
|
configuring the application.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load cached env vars if the .env.local.php file exists
|
// Load cached env vars if the .env.local.php file exists
|
||||||
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
|
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
|
||||||
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
|
if (
|
||||||
|
is_array($env = @include dirname(__DIR__) . '/.env.local.php') &&
|
||||||
|
(!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])
|
||||||
|
) {
|
||||||
(new Dotenv(false))->populate($env);
|
(new Dotenv(false))->populate($env);
|
||||||
} else {
|
} else {
|
||||||
// load all the .env files
|
// load all the .env files
|
||||||
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
|
(new Dotenv(false))->loadEnv(dirname(__DIR__) . '/.env');
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SERVER += $_ENV;
|
$_SERVER += $_ENV;
|
||||||
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
|
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
|
||||||
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
|
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
|
||||||
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
|
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG']
|
||||||
|
|| filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
|
||||||
|
|
|
@ -4,7 +4,7 @@ use App\Kernel;
|
||||||
use Symfony\Component\ErrorHandler\Debug;
|
use Symfony\Component\ErrorHandler\Debug;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
require dirname(__DIR__).'/config/bootstrap.php';
|
require dirname(__DIR__) . '/config/bootstrap.php';
|
||||||
|
|
||||||
if ($_SERVER['APP_DEBUG']) {
|
if ($_SERVER['APP_DEBUG']) {
|
||||||
umask(0000);
|
umask(0000);
|
||||||
|
@ -13,7 +13,10 @@ if ($_SERVER['APP_DEBUG']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
|
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
|
||||||
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
Request::setTrustedProxies(
|
||||||
|
explode(',', $trustedProxies),
|
||||||
|
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
|
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
|
||||||
|
|
|
@ -15,5 +15,4 @@ final class EventCollection extends Collection
|
||||||
return !Arr::get($rsvp, 'member.event_context.host');
|
return !Arr::get($rsvp, 'member.event_context.host');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ final class GetRaffleWinnerCommand extends Command
|
||||||
'%s - %s',
|
'%s - %s',
|
||||||
$this->eventData['group']['name'],
|
$this->eventData['group']['name'],
|
||||||
$this->eventData['name']
|
$this->eventData['name']
|
||||||
));
|
));
|
||||||
|
|
||||||
$io->section(sprintf('%s \'yes\' RSVPs (excluding hosts)', $this->yesRsvps->count()));
|
$io->section(sprintf('%s \'yes\' RSVPs (excluding hosts)', $this->yesRsvps->count()));
|
||||||
$io->listing($this->yesRsvps->pluck('member.name')->sort()->toArray());
|
$io->listing($this->yesRsvps->pluck('member.name')->sort()->toArray());
|
||||||
|
@ -192,5 +192,4 @@ final class GetRaffleWinnerCommand extends Command
|
||||||
exec(sprintf('xdg-open %s', $photo));
|
exec(sprintf('xdg-open %s', $photo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Kernel extends BaseKernel
|
||||||
|
|
||||||
public function registerBundles(): iterable
|
public function registerBundles(): iterable
|
||||||
{
|
{
|
||||||
$contents = require $this->getProjectDir().'/config/bundles.php';
|
$contents = require $this->getProjectDir() . '/config/bundles.php';
|
||||||
foreach ($contents as $class => $envs) {
|
foreach ($contents as $class => $envs) {
|
||||||
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
|
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
|
||||||
yield new $class();
|
yield new $class();
|
||||||
|
@ -32,23 +32,23 @@ class Kernel extends BaseKernel
|
||||||
|
|
||||||
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
|
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
|
||||||
{
|
{
|
||||||
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
|
$container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php'));
|
||||||
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
|
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
|
||||||
$container->setParameter('container.dumper.inline_factories', true);
|
$container->setParameter('container.dumper.inline_factories', true);
|
||||||
$confDir = $this->getProjectDir().'/config';
|
$confDir = $this->getProjectDir() . '/config';
|
||||||
|
|
||||||
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
|
$loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
|
||||||
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
|
$loader->load($confDir . '/{packages}/' . $this->environment . '/*' . self::CONFIG_EXTS, 'glob');
|
||||||
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
|
$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
|
||||||
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
|
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function configureRoutes(RouteCollectionBuilder $routes): void
|
protected function configureRoutes(RouteCollectionBuilder $routes): void
|
||||||
{
|
{
|
||||||
$confDir = $this->getProjectDir().'/config';
|
$confDir = $this->getProjectDir() . '/config';
|
||||||
|
|
||||||
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
|
$routes->import($confDir . '/{routes}/' . $this->environment . '/*' . self::CONFIG_EXTS, '/', 'glob');
|
||||||
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
|
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
|
||||||
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
|
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue