Skip to content

Commit

Permalink
EZP-30667: Made database charset and collation configurable via dotenv (
Browse files Browse the repository at this point in the history
  • Loading branch information
webhdx authored and lserwatka committed Jul 9, 2019
1 parent f221270 commit 7c8d8e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ DATABASE_PASSWORD=SetYourOwnPassword
DATABASE_NAME=ezp
DATABASE_HOST=db
DATABASE_PORT=3306
DATABASE_DRIVER=mysql
DATABASE_PLATFORM=mysql
DATABASE_DRIVER=pdo_mysql

# Doctrine DBAL Schema
# set here for BC reasons, change them in parameters.yml
Expand All @@ -70,7 +71,7 @@ APP_SECRET=ff6dc61a329dc96652bb092ec58981f7
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=${DATABASE_DRIVER}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}
DATABASE_URL=${DATABASE_PLATFORM}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
Expand Down
12 changes: 6 additions & 6 deletions config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ parameters:
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
env(DATABASE_DRIVER): ''
database_driver: '%env(DATABASE_DRIVER)%'

doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
driver: '%database_driver%'
charset: '%database_charset%'
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci

charset: '%database_charset%'
collate: '%database_collation%'
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: true
Expand Down

0 comments on commit 7c8d8e4

Please sign in to comment.