{"action":"closed","issue":{"url":"https://api.github.com/repos/docker/compose/issues/4490","repository_url":"https://api.github.com/repos/docker/compose","labels_url":"https://api.github.com/repos/docker/compose/issues/4490/labels{/name}","comments_url":"https://api.github.com/repos/docker/compose/issues/4490/comments","events_url":"https://api.github.com/repos/docker/compose/issues/4490/events","html_url":"https://github.com/docker/compose/issues/4490","id":207834688,"number":4490,"title":"Feature request: Optional Environment variables","user":{"login":"andrerom","id":289757,"avatar_url":"https://avatars.githubusercontent.com/u/289757?v=3","gravatar_id":"","url":"https://api.github.com/users/andrerom","html_url":"https://github.com/andrerom","followers_url":"https://api.github.com/users/andrerom/followers","following_url":"https://api.github.com/users/andrerom/following{/other_user}","gists_url":"https://api.github.com/users/andrerom/gists{/gist_id}","starred_url":"https://api.github.com/users/andrerom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrerom/subscriptions","organizations_url":"https://api.github.com/users/andrerom/orgs","repos_url":"https://api.github.com/users/andrerom/repos","events_url":"https://api.github.com/users/andrerom/events{/privacy}","received_events_url":"https://api.github.com/users/andrerom/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-02-15T15:23:54Z","updated_at":"2017-02-15T20:26:54Z","closed_at":"2017-02-15T20:26:54Z","body":"### Context:\r\nMost applications already have defaults for the environment variables they support, and furthermore in several applications there is logic connecting one variable with another, for instance global dev flag automatically disabling caching and enabling debug unless config says otherwise.\r\n\r\n### Possible Solution:\r\nBy allowing compose to support optional environment variables we can solve:\r\n- having to replicate defaults in our `.env` fields and/or our `docker-compose.yml` files\r\n- forcing users to define all or nothing on env variables when switching global dev flags but having issues as debug flag being now set to false as default is set for production\r\n  - _Side: This part can also be solved with additional .env files, however you end up having to duplicate defaults exponentially with the complexity of the applications environment variables inter variable dependencies.  \r\n\r\nFormat might be whatever, but here is one possible syntax for it:\r\n```yml\r\nservices:\r\n  app:\r\n    image: php:7.1-fpm\r\n    environment:\r\n     - ?SYMFONY_ENV\r\n     - ?SYMFONY_DEBUG\r\n     - ?SYMFONY_HTTP_CACHE\r\n     - DATABASE_USER\r\n     - DATABASE_PASSWORD\r\n     - DATABASE_NAME\r\n     - DATABASE_HOST=db\r\n```\r\n"}}
{"actor":{"display_login":"andrerom"}}