Expand my Community achievements bar.

pass env vars to all actions

Avatar

Community Advisor

I have some .env variables I want to pass to all actions. Until now, I added the variables in question as params to all actions in the manifest.yml file. but too often I changed something and forgotten to change the manifest as well.

question: is there a way to have "real env variables", without adding them to all actions? I tried to use env vars starting with "__OW_" but that was not a success...

any hints hiw to do that?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

8 Replies

Avatar

Employee

just to clarify - do you want to use some custom params you set yourself, or the default params available as __OW_* ? For default params you could do e.g. `process.env.__OW_NAMESPACE` (but should be careful that you may accidentally expose your namespace credentials).

Avatar

Community Advisor
I have custom vars which I want to have access to in all actions. means any other solution than manually add them to all action params in the manifest.yml and the access the custom vars within the action.

Avatar

Community Advisor
example - as an idea: I define "__OW_CUSTOMVARS_myVarName" and then access the value with an action with "process.env.__OW_CUSTOMVARS_myVarName"

Avatar

Employee
Ok - I don't think it is possible with I/O Runtime today, but agree that it's a very handy feature to have in "apps". Let me do some searches if any related enhancement ticket exists.

Avatar

Community Advisor
@duynpguyen do you have any updates on this?

Avatar

Employee
@Urs_Boller - I don't have any update yet, but did bring it up for more elaborated discussions with the team. I hope to share a more insightful feedback to you within the next weeks.

Avatar

Employee

Hi @Urs_Boller  - I just recall a way to share the variables across your actions without repeating it in the manifest per action.

Because all actions are placed under the `__APP_PACKAGE__`, you could also set the default params of the package. Then you are able to get them in each action, just in the same manner as setting default params per action.

This is not yet part of the manifest.yaml definition, but you could use the CLI, e.g. `aio runtime package update sample-app-0.0.1 --param name "Firefly"`.