{"action":"opened","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/25129","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/25129/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/25129/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/25129/events","html_url":"https://github.com/symfony/symfony/issues/25129","id":276309217,"number":25129,"title":"[DI][Improvement] Allow to define a default value on environment variables","user":{"login":"vincentchalamon","id":407859,"avatar_url":"https://avatars1.githubusercontent.com/u/407859?v=4","gravatar_id":"","url":"https://api.github.com/users/vincentchalamon","html_url":"https://github.com/vincentchalamon","followers_url":"https://api.github.com/users/vincentchalamon/followers","following_url":"https://api.github.com/users/vincentchalamon/following{/other_user}","gists_url":"https://api.github.com/users/vincentchalamon/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentchalamon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentchalamon/subscriptions","organizations_url":"https://api.github.com/users/vincentchalamon/orgs","repos_url":"https://api.github.com/users/vincentchalamon/repos","events_url":"https://api.github.com/users/vincentchalamon/events{/privacy}","received_events_url":"https://api.github.com/users/vincentchalamon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-23T09:29:56Z","updated_at":"2017-11-23T09:29:56Z","closed_at":null,"author_association":"NONE","body":"| Q                | A\r\n| ---------------- | -----\r\n| Bug report?      | no\r\n| Feature request? | yes\r\n| BC Break report? | no\r\n| RFC?             | no\r\n| Symfony version  | 3.4\r\n\r\nSince Symfony 3.4, it's now possible to parse environment variables using `%env()%` tool: https://goo.gl/8Zsed6\r\n\r\nBut in some environment, I don't have the right environment variables set, so the application is not bootable (on Insight analysis for instance). To fix it, I need to define the environment variable on a parameter key:\r\n```yml\r\nparameters:\r\n    db_hostname: '%env(DB_HOSTNAME)%'\r\n    env(DB_HOSTNAME): db\r\n\r\ndoctrine:\r\n    dbal:\r\n        host: '%db_hostname%'\r\n```\r\n\r\nIt should be interesting to parse a default value directly on the `%env()%` tool:\r\n```yml\r\ndoctrine:\r\n    dbal:\r\n        host: '%env(default:db:DB_HOSTNAME)%'\r\n```"}}
{"actor":{"display_login":"vincentchalamon"}}