Search code examples
erlangejabberd

check for stage prod ejabberd instance in a module


I have a mod_uc_filter.erl module. it sends packet to python for filtering, after encoding the packet with base64. For testing purposes i need to encode the packet but in prod the packet is already encoded by the client. How would one keep a prod / test check before executing statement in ejabberd:

BodyB64 = base64:encode_to_string(Body), %THIS STEP IS NOT REQUIRED IN PROD

Solution

  • It all depends how you can know if you are on a prod or test environment. For example, you could had configuration parameter for your module is ejabberd configuration file and have your code behave differently depending on the value your read from ejabberd configuration file.