# .env variables staging and prod

**URL:** https://discourse.roots.io/t/env-variables-staging-and-prod/24901
**Category:** sage
**Tags:** deploys, sage10, trellis
**Created:** 2023-03-03T12:24:44Z
**Posts:** 5
**Showing post:** 5 of 5

## Post 5 by @manu.weg — 2023-03-05T11:12:43Z

So I think the best way to go about adding environment specific env variables is to add them to your environment group\_vars in trellis (assuming you are using rellis which I am)

> [@Custom env variables trellis](https://discourse.roots.io/t/custom-env-variables-trellis/6330/2):
>
> If you want custom variables in the .env file created on deploy, each WP site will create env variables using the [wordpress\_env\_defaults](https://github.com/roots/trellis/blob/fc44e94d6f174792b00833d79a89dd92d4b1daf8/deploy.yml#L16-L23) from deploy.yml. To override or add to these env variables, you can edit group\_vars/\<environment\>/wordpress\_sites.yml. For example, if for example.com you wanted to override the default db\_name and add a new var new\_env\_var, you could add this for the site example.com: wordpress\_sites: example.com: ... env: db\_name: override\_name new\_env\_var: fo…

---

_[View the full topic](https://discourse.roots.io/t/env-variables-staging-and-prod/24901)._
