# How do I set Heroic Cloud env vars?

**URL:** <https://forum.heroiclabs.com/t/how-do-i-set-heroic-cloud-env-vars/1902>\
**Category:** Game Design\
**Tags:** server-framework\
**Created:** [August 25, 2021, 3:43pm UTC](https://forum.heroiclabs.com/t/how-do-i-set-heroic-cloud-env-vars/1902 "2021-08-25T15:43:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SPMK](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@SPMK](https://forum.heroiclabs.com/u/SPMK)\
**Post date:** [August 25, 2021, 3:43pm UTC](https://forum.heroiclabs.com/t/how-do-i-set-heroic-cloud-env-vars/1902/1 "2021-08-25T15:43:44Z")

</div>

Trying to deploy a nakama build with custom plugins on heroic cloud. Need to pass a few environment variables and setting them under ‘CONFIGURATIONS’-\>‘runtime.env’ but they are not available when the build is run. I can see them in the ‘Console’ though. Golang code used to get the variable values:

```auto
os.Getenv("MY_ENV_VAR")

```

Can’t even get variable `ENVIRONMENT_NAME` value which is automatically set by heroic cloud. Am I doing anything wrong somewhere?

More info:  
Nakama Image - heroiclabs/nakama-enterprise:3.5.0-r2-mc

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [August 25, 2021, 5:39pm UTC](https://forum.heroiclabs.com/t/how-do-i-set-heroic-cloud-env-vars/1902/2 "2021-08-25T17:39:53Z")

</div>

@SPMK The values you set in the configuration do not get written to the OS environment. What you’re looking for is Nakama’s runtime context environment, and here’s a usage example from the Go runtime:

```auto
func InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, initializer runtime.Initializer) error {
    vars, _ := ctx.Value(runtime.RUNTIME_CTX_ENV).(map[string]string)
    myEnvVar := vars["MY_ENV_VAR"]
}

```

This will give you any values you’ve set in the `runtime.env` configuration either in the dashboard or in a `.yml` config file. It’s exactly the same standard Nakama functionality and code as you would use running the server yourself for development.

---

<div class="post-metadata">

**Author:** ![SPMK](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@SPMK](https://forum.heroiclabs.com/u/SPMK)\
**Post date:** [August 26, 2021, 2:58am UTC](https://forum.heroiclabs.com/t/how-do-i-set-heroic-cloud-env-vars/1902/3 "2021-08-26T02:58:21Z")

</div>

This works, thank you!
