Using secrets outside of connectors?

Hey all,

I’m using Camunda 8 Cloud and it seems there aren’t any environment variables to use.

I figured I could use secrets as a substitute but I can’t seem to use them outside of the connectors.

Was there anyway to take a secret and turn it into a process variable? I tried using a script but I can’t seem to get it to work.

Could you please share the code what you are trying it to do.

Not much code here to give, but say I’ve defined a secret in my cluster named ENV with a value “Dev”.

Using a script task, I output a variable called environment with it equal to the feel expression:

"{{secrets.ENV}}"

I would expect then to get:

environment : "Dev"

but instead I get:

environment : "{{secrets.ENV}}"

I want to get the value of a secret outside a rest connector because I would like to control my flow based on my cluster environment.

Would you please try defining it as “secrets.ENV” instead of “{{ secrets.ENV}}”.

Unfortunately I get the following error:

failed to evaluate expression 'secrets.ENV': no variable found for name 'secrets'

That does make sense according to the documents. Scripts can only take a FEEL expression and the syntax to use secrets in them are the double curly braces.

I’ve looked around and it looks like this isn’t possible as of yet. I probably need to wait until some kind of environment variables is implemented.

Hello @David-Rach ,

the thing with secrets is that they are meant to be used with connectors.

Your secret will never be revealed/replaced to the process engine. Instead, a secret is meant to be used in the connector only.

A secret is then just a string like ‘secrets.ENV’.

If you want to use secrets in your own job workers, you should create your own replacement mechanism or use the nodejs connector sdk:

I hope this helps

Jonathan

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.