How to pass env variables into bpmn flow?

I have bpmn flow which needs to call external service with different user/pass for different environment - stagin/prod/local. How do I better approach it? I’ve extracted config into separate bpmn, and trying to call it from main bpmn (via call activity), however this is not preferable solution. Ideally, I’d like to pass env variable into docker container like:

environment:
- USER=staging-user
- PASSWORD=staging-password

And next somehow read them in bpmn flow (ideally from modeler, no custom java code). Is it possible? Can I achieve this?

2 Likes

See:

If you want to use ENV vars then you can easily access them from a Javascript based Script in the BPMN:

var password = System.getenv('MY_PASSWORD_ENV')
3 Likes

Thanks Stephen! This seems to be an exact answer of what I asked (will check on Monday). One more question: is there somewhere an complete javascript api I can use in camunda model? I have a lot of experience in javascript and much less in java, so having an complete javascript api doc would be really helpful for me.

See the scripting docs for camunda for a few keywords and variables that are available during executions. Other than that its regular Nashorn Javascript. So you can look over the Java Nashorn Docs (google it: Nashorn Javascript).

Also if you search the forum you will find a lot of examples to likely most of your issues that i have posted (i have shared a lot of javascript examples and usages).

Feel free to reach out again if you are trying to solve any js issues.

1 Like

Works well after adding:

var system = java.lang.System