From 5d98e87e20c18b1698423200ad2de55c5b142753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Tue, 7 Jan 2020 19:06:08 +0100 Subject: [PATCH] Updated recipes for symfony/framework-bundle. --- .env | 4 ++-- .gitignore | 1 + config/packages/cache.yaml | 10 ++++----- config/packages/framework.yaml | 3 +-- config/routes/dev/framework.yaml | 3 +++ public/index.php | 2 +- src/Kernel.php | 38 +++++++++----------------------- symfony.lock | 7 +++--- 8 files changed, 28 insertions(+), 40 deletions(-) create mode 100644 config/routes/dev/framework.yaml diff --git a/.env b/.env index 57ec77fb..1eb7f8da 100644 --- a/.env +++ b/.env @@ -15,8 +15,8 @@ ###> symfony/framework-bundle ### APP_ENV=prod -APP_SECRET=7915fd8481d1a52cf42010ebe2caa974 -#TRUSTED_PROXIES=127.0.0.1,127.0.0.2 +APP_SECRET=74893fb247b116fb5d2c45e3b076c20f +#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 #TRUSTED_HOSTS='^localhost|example\.com$' ###< symfony/framework-bundle ### diff --git a/.gitignore b/.gitignore index 70a6c989..c48ca00c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /.env.local /.env.local.php /.env.*.local +/config/secrets/prod/prod.decrypt.private.php /public/bundles/ /var/ /vendor/ diff --git a/config/packages/cache.yaml b/config/packages/cache.yaml index a3e47f71..07ecf18a 100644 --- a/config/packages/cache.yaml +++ b/config/packages/cache.yaml @@ -1,10 +1,10 @@ framework: cache: - # Put the unique name of your app here: the prefix seed - # is used to compute stable namespaces for cache keys. + # Unique name of your app: used to compute stable namespaces for cache keys. prefix_seed: Part-DB/Part-DB - # The app cache caches to the filesystem by default. + # The "app" cache stores to the filesystem by default. + # The data in this cache should persist between deploys. # Other options include: # Redis @@ -18,5 +18,5 @@ framework: pools: # Here all things related to cache the tree structures tree.cache: - adapter: cache.app - tags: true + adapter: cache.app + tags: true diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index d3f884c4..6089f4bd 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -1,13 +1,12 @@ framework: secret: '%env(APP_SECRET)%' - #default_locale: en #csrf_protection: true #http_method_override: true # Enables session support. Note that the session will ONLY be started if you read or write from it. # Remove or comment this section to explicitly disable session support. session: - handler_id: ~ + handler_id: null cookie_secure: auto cookie_samesite: lax diff --git a/config/routes/dev/framework.yaml b/config/routes/dev/framework.yaml new file mode 100644 index 00000000..bcbbf13d --- /dev/null +++ b/config/routes/dev/framework.yaml @@ -0,0 +1,3 @@ +_errors: + resource: '@FrameworkBundle/Resources/config/routing/errors.xml' + prefix: /_error diff --git a/public/index.php b/public/index.php index affa0bc0..1bd06d3e 100644 --- a/public/index.php +++ b/public/index.php @@ -21,7 +21,7 @@ */ use App\Kernel; -use Symfony\Component\Debug\Debug; +use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\HttpFoundation\Request; require dirname(__DIR__).'/config/bootstrap.php'; diff --git a/src/Kernel.php b/src/Kernel.php index c181c716..1cd05726 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -1,27 +1,5 @@ getProjectDir().'/config/bundles.php'; foreach ($contents as $class => $envs) { @@ -47,14 +25,20 @@ class Kernel extends BaseKernel } } + public function getProjectDir(): string + { + return \dirname(__DIR__); + } + protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); - $container->setParameter('container.dumper.inline_class_loader', true); + $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug); + $container->setParameter('container.dumper.inline_factories', true); $confDir = $this->getProjectDir().'/config'; $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}_'.$this->environment.self::CONFIG_EXTS, 'glob'); } @@ -63,8 +47,8 @@ class Kernel extends BaseKernel { $confDir = $this->getProjectDir().'/config'; + $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); } } diff --git a/symfony.lock b/symfony.lock index 3452f031..8cccf0e5 100644 --- a/symfony.lock +++ b/symfony.lock @@ -520,18 +520,19 @@ "version": "v4.2.3" }, "symfony/framework-bundle": { - "version": "4.2", + "version": "4.4", "recipe": { "repo": "github.com/symfony/recipes", "branch": "master", - "version": "4.2", - "ref": "5bb3a8c27df824d195fa68bb635d074854f8498f" + "version": "4.4", + "ref": "23ecaccc551fe2f74baf613811ae529eb07762fa" }, "files": [ "./config/bootstrap.php", "./config/packages/cache.yaml", "./config/packages/framework.yaml", "./config/packages/test/framework.yaml", + "./config/routes/dev/framework.yaml", "./config/services.yaml", "./public/index.php", "./src/Controller/.gitignore",