Skip FOLIO Project Navigation

How does a raml-module-builder based module read params from OKAPI environment varialbles and local config files?

I am developing a module based on raml-module-builder,dependencies and plugin configs are copied from mod-notify module.I have designed my raml file and now is trying to implement the generated interfaces.Would anyone be so kind to answer the following questions:

  1. Could I read OKAPI environment variables in my own coding assumes the module is already registed on OKAPI?
  2. How do I config module to read params from a local config file and how could I get these param in coding?
    Thank you so much.

Hellow @zhang. There is a little bit about the Okapi environment variables in the Guide and Reference document. There are probably examples in other modules that you can use to see how this works.

In answer to your second question, I don’t think you are going to want to read parameters from a local configuration file. Doing so runs counter to how Okapi modules are multi-tenant and should be getting their settings from the Okapi environment variable mechanism described above. Perhaps you can describe what you were trying to do and we can make sure it is the aligned with the best practices for Okapi modules.

Thanks a lot for your reply.
I check some backend mods and find “env” property in LanuchDescriptor,is it the right way to pass specified environment variable to the module?
If I need to read env variables from Okapi, make http request to /_/env path should do the trick.
Please tell me If I got it right.
Just for my curiosity, does Okapi have the mechanism to notify mods when env variable changed?

Okapi can’t notify mods when env variable changed, only these parameters are reloaded when the module is redeployed