how get env variables from docker in symfony yml config file

后端 未结 2 512
温柔的废话
温柔的废话 2021-01-06 15:05

in docker-compose.yml:

mysql:
  image: mysql:latest
  container_name: mysql
  environment:
    - MYSQL_ROOT_PASSWORD=root
    - MYSQL_DATABASE=symfony
    -          


        
2条回答
  •  再見小時候
    2021-01-06 15:28

    There now (as of Symfony 3.2) is a syntax to do this in yaml files:

    # app/config/parameters.yml
    parameters:
        database_host: '%env(DATABASE_HOST)%'
    

    see http://symfony.com/doc/current/configuration/external_parameters.html

提交回复
热议问题