Enhance params and envs

This commit is contained in:
thibaud-leclere
2026-01-15 13:16:09 +01:00
parent b38ef63395
commit be171b45b4
5 changed files with 18 additions and 28 deletions

20
.env
View File

@@ -26,23 +26,6 @@ APP_SHARE_DIR=var/share
DEFAULT_URI=http://localhost DEFAULT_URI=http://localhost
###< symfony/routing ### ###< symfony/routing ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:pwd@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
POSTGRES_VERSION=16
POSTGRES_HOST=127.0.0.1
POSTGRES_PORT=5432
POSTGRES_DB=app
POSTGRES_USER=app
POSTGRES_PASSWORD=pwd
###< doctrine/doctrine-bundle ###
###> symfony/messenger ### ###> symfony/messenger ###
# Choose one of the transports below # Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages # MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
@@ -53,6 +36,3 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###> symfony/mailer ### ###> symfony/mailer ###
MAILER_DSN=null://null MAILER_DSN=null://null
###< symfony/mailer ### ###< symfony/mailer ###
TMDB_API_TOKEN=eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJkZmE5NDZmMTZmMTcyYmNlMzk0MzZiZmVhZDc2ZTk3NCIsIm5iZiI6MTY0OTE4MjMyNS43NTAwMDAyLCJzdWIiOiI2MjRjODY3NWFmNThjYjAwNTE1NzZiYmEiLCJzY29wZXMiOlsiYXBpX3JlYWQiXSwidmVyc2lvbiI6MX0.KE68nNxPGYWr5WHVaUuILMOH3sPhiAc9CucPVTgRPpM
TMDB_HOST=https://api.themoviedb.org/3

View File

@@ -1,12 +1,12 @@
doctrine: doctrine:
dbal: dbal:
driver: pdo_pgsql driver: pdo_pgsql
host: '%env(resolve:POSTGRES_HOST)%' host: '%postgres_host%'
port: '%env(resolve:POSTGRES_PORT)%' port: '%postgres_port%'
dbname: '%env(resolve:POSTGRES_DB)%' dbname: '%postgres_db%'
user: '%env(resolve:POSTGRES_USER)%' user: '%postgres_user%'
password: '%env(resolve:POSTGRES_PASSWORD)%' password: '%postgres_password%'
server_version: '%env(resolve:POSTGRES_VERSION)%' server_version: '%postgres_version%'
charset: utf8 charset: utf8
# IMPORTANT: You MUST configure your server version, # IMPORTANT: You MUST configure your server version,

9
config/parameters.yml Normal file
View File

@@ -0,0 +1,9 @@
parameters:
postgres_version: "16"
postgres_host: "127.0.0.1"
postgres_port: "5432"
postgres_db: "app"
postgres_user: "app"
postgres_password: "pwd"
tmdb_host: "https://api.themoviedb.org/3"

View File

@@ -6,7 +6,8 @@
# Put parameters here that don't need to change on each machine where the app is deployed # Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters: imports:
- { resource: parameters.yml }
services: services:
# default configuration for services in *this* file # default configuration for services in *this* file

View File

@@ -20,7 +20,7 @@ class TMDBGateway
private readonly SerializerInterface $serializer, private readonly SerializerInterface $serializer,
#[Autowire('%env(TMDB_API_TOKEN)%')] #[Autowire('%env(TMDB_API_TOKEN)%')]
private readonly string $apiToken, private readonly string $apiToken,
#[Autowire('%env(TMDB_HOST)%')] #[Autowire('%tmdb_host%')]
private readonly string $host, private readonly string $host,
) { ) {
} }