Export Config object to on InitModule method

Hi guys,

I’m using Nakama 3.10 with Go module.
In the InitModule, how can i use the server Config to setup some addition module.
For example logging config

Hello,

If you need other things besides logging which is already provided and configurable from Nakama: Configuration -  Heroic Labs Documentation you can always initialize anything from within the InitModule(…). In theory you could even have multiple InitModule(…) declarations but we don’t see that very often. If the question is about how to initialize something and then make it available say in various hooks then you’ll need to illustrate a bit more on the specifics.

Thank @mharis,

Are there anyway to add custom configuration on config.yaml file ?

Nakama config has runtime.env section where you can put any environment variables if that’s enough for what you need: Nakama: Configuration -  Heroic Labs Documentation

1 Like

Hi @mharis,
I saw that the framework has a constant of RUNTIME_CTX_ENV

I understand that i can access the runtime.env in the context with this key. Please correct me if i wrong.
If it’s true, this guide should have a place in the document page.

Hi, that’s right, anything you’ve passed in to the configuration file under runtime.env can be retrieved with that key from the context as a map[string]string. You can find more detailed walk-through in this forum thread: Settings and stored state for a Go plugin

1 Like

Thank for your recommendation.
For now I am using runtime env to store addition config path and using yaml to parse the configuration.