How do I read from sys.config in my ejabberd release?

I'm running ejabberd 23.01- I would like to read some values from my sys.config file.

When running ejabberd as relive in VSCode, running ejabberdctl debug and running application:get_env(ejabberd, config). gives me a tuple containing the ejabberd.yml path. I've deduced that this path comes from the relive.config file, and I've been able to successfully store and read my values from the file as well.

My issue is however, with the release- making the same modifications to sys.config and then making a release by running make rel pushes the sys.config file to the releases/23.01 folder, and upon starting the release from bin/ejabberdctl start and running bin/ejabberdctl debug+application:get_env(ejabberd, config)., it returns an undefined value.

What am I missing? Am I starting up my ejabberd release wrong(in a way that does not keep sys.config in mind while starting the application)?



  • Okay, so I found a workaround - not the best, but it works, and it's configurable and probably more so than the sys.config route.

    I made another module that reads options from the ejabberd.yml file, and on module startup, uses application:set_env/3 to set application variables for the target application.

    This will obviously fail if the application is functions (that are dependent on these values) are triggered before the envs are set, but it works for my use case.