# Substitute environment variables in drone.yml using a ".env" file

**URL:** <https://drone.discourse.group/t/substitute-environment-variables-in-drone-yml-using-a-env-file/9138>\
**Category:** Drone Support\
**Created:** [March 23, 2021, 8:24pm UTC](https://drone.discourse.group/t/substitute-environment-variables-in-drone-yml-using-a-env-file/9138 "2021-03-23T20:24:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trepmag](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/trepmag/32/5716_2.png) [@trepmag](https://drone.discourse.group/u/trepmag)\
**Post date:** [March 23, 2021, 8:24pm UTC](https://drone.discourse.group/t/substitute-environment-variables-in-drone-yml-using-a-env-file/9138/1 "2021-03-23T20:24:08Z")

</div>

From the documentation we can [substitution](https://docs.drone.io/pipeline/environment/substitution/) for pipeline environment variable.

Would it make sense to allow substitution from `.env` file like [docker-compose](https://docs.docker.com/compose/environment-variables/)?

It would allow to specify some build variable in one place that could be used by drone but also other tools…

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 24, 2021, 12:47am UTC](https://drone.discourse.group/t/substitute-environment-variables-in-drone-yml-using-a-env-file/9138/2 "2021-03-24T00:47:32Z")

</div>

The yaml is parsed before the code is cloned (which is not something that can be changed). This means it would not be possible to read an env file from your repository and substitute in the yaml, since the yaml would have already been parsed.
