# Wordpress_env_defaults in helpers.yml not working?

**URL:** https://discourse.roots.io/t/wordpress-env-defaults-in-helpers-yml-not-working/22529
**Category:** trellis
**Tags:** trellis
**Created:** 2022-03-11T00:29:26Z
**Posts:** 9

## Post 1 by @adleviton — 2022-03-11T00:29:26Z

Not sure what I’m missing here, but if I try and change any settings for `wordpress_env_defaults` in group\_vars/all/helpers.yml, it does not update my .env file. Any advice out there?

---

## Post 2 by @swalkinshaw — 2022-03-11T00:36:05Z

Is this in development or for a remote server?

If you deployed and didn’t see any changes, it’s likely because there’s a separate definition of `wordpress_env_defaults` in the deploy role: [trellis/main.yml at b6fde51906a5a8a6fad2860a8db585c7a0c4ae1a · roots/trellis · GitHub](https://github.com/roots/trellis/blob/b6fde51906a5a8a6fad2860a8db585c7a0c4ae1a/roles/deploy/vars/main.yml)

What are you trying to accomplish exactly? There might be another way.

---

## Post 3 by @adleviton — 2022-03-11T00:59:02Z

This is for a remote server. I was expecting that making changes to `wordpress_env_defaults` in helpers.yml would override roles/deploy/vars/main.yml.

I’m specifically trying to set `disable_wp_cron` and `wp_post_revisions`. It seemed like helpers.yml was a good place to do this … but I ended up just adding these to group\_vars/all/vault.yml.

---

## Post 4 by @swalkinshaw — 2022-03-11T05:30:26Z

Any values defined under a site’s `env` setting will override those defaults. So you can just set them on a per site basis in `group_vars/<env>/wordpress_sites.yml` which is documented [here](https://docs.roots.io/trellis/master/wordpress-sites/#options) (`wp_post_revisions` isn’t there, but should be since it’s supported too).

They aren’t “secrets” so they don’t need to be in `vault.yml` either.

---

## Post 5 by @adleviton — 2022-03-11T17:12:39Z

I only added these 2 settings to `group_vars/all/vault.yml` since I’d like them to apply to all environments. If there’s another way to do that, let me know. Otherwise, yes, I’d have to add them on a per site basis like you described. I guess I just was confused about the purpose of helpers.yml … is that just for reference?

---

## Post 6 by @swalkinshaw — 2022-03-11T17:36:14Z

> [@adleviton](#):
>
> I guess I just was confused about the purpose of helpers.yml … is that just for reference?

They are used in development since the `deploy` role isn’t included/used at all. There’s probably a better way to define them so it’s only done in one place :thinking: but while the values are the same, they access other variables in different ways so it’s hard to unify them.

---

## Post 7 by @visualasparagus — 2022-12-02T15:23:28Z

So if one wants to be DRY, where is the best place to define environment variables for local/dev as well as remote environments. Is there any sort of global\_env possible in all/main.yml or is all/vault.yml the only spot. Even if they are not secret.

---

## Post 8 by @swalkinshaw — 2022-12-03T16:01:32Z

I don’t think it’s possible unfortunately. You have to maintain the two different version of it.

I’ll give it some thought to see if any improvements can be made but it’s hard because each value is derived from a different implementation (dev vs deploy). It would be possible to extract out a common list of _static_/hardcoded attributes though but that’s only part of it.

---

## Post 9 by @visualasparagus — 2022-12-05T13:13:58Z

Ok, thanks for the answer. In an older version of trellis I did use something called global\_env: in the main.yml but that doesn’t seem to work anymore.
