Skip to content

Commit a21aa0c

Browse files
committed
feat: sync recipes
1 parent ce4f91a commit a21aa0c

10 files changed

Lines changed: 124 additions & 122 deletions

File tree

api/.env

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,22 @@
1414
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
1515

1616
# API Platform distribution
17+
TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
18+
TRUSTED_HOSTS=^(localhost|caddy)$
1719
MERCURE_SUBSCRIBE_URL=https://localhost/.well-known/mercure
1820

1921
###> symfony/framework-bundle ###
2022
APP_ENV=dev
2123
APP_SECRET=!ChangeMe!
22-
TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
23-
TRUSTED_HOSTS='^(localhost|caddy)$'
2424
###< symfony/framework-bundle ###
2525

2626
###> doctrine/doctrine-bundle ###
2727
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
28-
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
29-
# For a MySQL database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
3028
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
31-
DATABASE_URL=postgres://api-platform:!ChangeMe!@database/api?server_version=13
29+
#
30+
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
31+
# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
32+
DATABASE_URL="postgresql://api-platform:!ChangeMe!@database:5432/api?serverVersion=13DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"charset=utf8"
3233
###< doctrine/doctrine-bundle ###
3334

3435
###> nelmio/cors-bundle ###

api/config/packages/api_platform.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ api_platform:
77
json: ['application/merge-patch+json']
88
swagger:
99
versions: [3]
10+
defaults:
11+
stateless: true
1012
# Mercure integration, remove if unwanted
1113
mercure:
1214
hub_url: '%env(MERCURE_SUBSCRIBE_URL)%'

api/config/packages/doctrine.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ doctrine:
44

55
# IMPORTANT: You MUST configure your server version,
66
# either here or in the DATABASE_URL env var (see .env file)
7-
server_version: '12'
7+
#server_version: '13'
88
orm:
99
auto_generate_proxy_classes: true
1010
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware

api/config/packages/framework.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# see https://symfony.com/doc/current/reference/configuration/framework.html
22
framework:
33
secret: '%env(APP_SECRET)%'
4+
trusted_proxies: '%env(TRUSTED_PROXIES)%'
5+
trusted_hosts: '%env(TRUSTED_HOSTS)%'
6+
# See https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#headers
7+
trusted_headers: ['x-forwarded-for', 'x-forwarded-proto']
48
#csrf_protection: true
59
#http_method_override: true
610

api/config/preload.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
4+
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
5+
}

api/public/index.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@
1515
Debug::enable();
1616
}
1717

18-
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
19-
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL);
20-
}
21-
22-
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
23-
Request::setTrustedHosts([$trustedHosts]);
24-
}
25-
2618
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
2719
$request = Request::createFromGlobals();
2820
$response = $kernel->handle($request);

api/src/Kernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected function configureContainer(ContainerConfigurator $container): void
1717
$container->import('../config/{packages}/'.$this->environment.'/*.yaml');
1818

1919
if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
20-
$container->import('../config/{services}.yaml');
20+
$container->import('../config/services.yaml');
2121
$container->import('../config/{services}_'.$this->environment.'.yaml');
2222
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
2323
(require $path)($container->withPath($path), $this);
@@ -30,7 +30,7 @@ protected function configureRoutes(RoutingConfigurator $routes): void
3030
$routes->import('../config/{routes}/*.yaml');
3131

3232
if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
33-
$routes->import('../config/{routes}.yaml');
33+
$routes->import('../config/routes.yaml');
3434
} elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
3535
(require $path)($routes->withPath($path), $this);
3636
}

0 commit comments

Comments
 (0)