Why is adding ENV not amending client side site settings

Hi @sam,

Maybe I am reading this wrong or doing this wrong?

In app.yml , I added a custom env var:

env:
   DISCOURSE_MY_ENV_TEST:  app

and rebuilt the container with a little custom plugin where I dumped all the site settings like this:

console.log(Discourse.SiteSettings);

and it nicely dumps all the site settings to the console as expected; but the custom env: var I set in app.yml do not seem to make it to site settings, as I expected.

Am I doing this wrong?

The reason I ask was I found this topic, searching and looking for a simple way to get env vars into the application so I can use in my plugin; and thought you may be saying that we can do this as described by adding them to the app.yml file; but it’s not working as expected.

PS: Sorry for resurrecting this old topic, but it seemed the closest match based on searching the site and I thought maybe replying here might be better than starting a new topic.

1 Like

You need to define a plugin with the site setting for this to work. We don’t just pass stuff blindly from ENV to the client.

2 Likes

Hi Sam,

Got it, I think:

So basically we cannot define a new env: variable in the yml file and have that env: var consumed by the site settings in the app unless we create a plugin for this purpose (to add an additional environmental variable for the site, configurable from the yml file).

Is that the correct understanding on my side?

Thanks!

1 Like

Yeah if you want a new site setting defined it must be added to a plugin.

4 Likes