# Arrancando una imagen de Docker de Discourse con la URL de SSO como variable de entorno

**URL:** https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107
**Category:** SSO
**Created:** [11 Abril, 2018 19:05 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107 "2018-04-11T19:05:11Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![shahidmir](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@shahidmir](https://meta.discourse.org/u/shahidmir)
#### Post date: [11 Abril, 2018 19:05 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/1 "2018-04-11T19:05:11Z")

</div>

Hi

Is it possible to set the SSO url in the docker build file (YAML file) for discourse, as opposed to using console scripts or via the discourse dashboard once deployed?

I have seen articles on this site mentioning other ways of doing it, but I would like to know if this is possible via the config files and at stage the docker image is created.

Regards

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [12 Abril, 2018 04:46 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/2 "2018-04-12T04:46:14Z")

</div>

We are fine with a PR that makes the setting shadowed by env, then you can supply them via env

---

<div class="post-metadata">

### Author: ![shahidmir](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@shahidmir](https://meta.discourse.org/u/shahidmir)
#### Post date: [13 Abril, 2018 14:27 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/3 "2018-04-13T14:27:18Z")

</div>

@sam Hi sam, what would i need to do to get this feature added?  
Not sure how this works, do I submit a request?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [13 Abril, 2018 17:21 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/4 "2018-04-13T17:21:15Z")

</div>

Is there some way to pass a site setting to Discourse through an Environment variable? (That’s what he seems to be asking).

My best solution to what I think his problem is is to use my [discourse-settings-uploader](https://github.com/pfaffman/discourse-settings-uploader), but the problem there is that I’ve not yet found a way to call `create_master_key` from a command line outside the container.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [16 Abril, 2018 02:59 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/5 "2018-04-16T02:59:27Z")

</div>

> [@pfaffman](#):
>
> Is there some way to pass a site setting to Discourse through an Environment variable?

> <https://github.com/discourse/discourse/blob/main/config/site_settings.yml#L12-L14>

So… for example per: [discourse/config/site\_settings.yml at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/config/site_settings.yml#L12-L14)

```plaintext
env:
   DISCOURSE_NOTIFICATION_EMAIL: 'bla@bla.com'

```

Will set `SiteSetting.notification_email` to `bla@bla.com`

---

<div class="post-metadata">

### Author: ![shahidmir](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@shahidmir](https://meta.discourse.org/u/shahidmir)
#### Post date: [17 Abril, 2018 13:36 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/6 "2018-04-17T13:36:47Z")

</div>

Hi Guys

sorry, seems like i wasnt clear in explaining what I needed.  
I am building a docker image of discourse and want to supply the site setting for the SSO URL via my docker build scripts.

So what I am now understanding after these responses is that only settings that are marked true for the “shadowed\_by\_global” setting can be set in the way I want.  
For other fields (including the SSO url) I either need to submit a PR to get the SSO field config updated so that i can be “shadowed”, or change my settings via the dashboard, or use the uploader suggested above?

Is this correct?

PS: My docker discourse project has a “discourse.conf” file which i believe is doing the settings in discourse e.g.

```
# username for smtp server
smtp_user_name = &lt;%= ENV['SMTP_USERNAME'] ? ENV['SMTP_USERNAME'] : '' %&gt;

```

Regards

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [24 Abril, 2018 20:15 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/7 "2018-04-24T20:15:13Z")

</div>

Hi, @shahidmir. I just got around to paying closer attention to this.

Yes, my read of Sam’s message is that you’d need to submit a PR that adds `shadowed_by_global: true` to the SSO field(s) that you want to set with an environment variable and that he’d likely accept it. That seems like the cleanest solution to your problem.

My uploader would also be a solution, but the trick with it is that you need the API key, which is something of a bother to set/get.

If you have a github account, you can simply visit the `site_settings.yml` link above, click the pencil icon, edit the file, save, and submit a PR. Spaces are very, very important in `yml` files, so it would be safest to copy-paste another “shadowed\_by\_global: true” line so that you don’t inadvertently enter a tab or the wrong number of spaces.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [13 Mayo, 2020 01:16 UTC](https://meta.discourse.org/t/bootstrapping-a-discourse-docker-image-with-sso-url-as-environment-variable/85107/8 "2020-05-13T01:16:38Z")

</div>

2 publicaciones se dividieron en un nuevo tema: [¿Por qué añadir ENV no modifica la configuración del sitio del lado del cliente](https://meta.discourse.org/t/why-is-adding-env-not-amending-client-side-site-settings/151271)
