How do I set Heroic Cloud env vars?

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:


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

@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:

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.

This works, thank you!