Store variables in files for use in flow?

Hello everyone!

I am currently working on a project where I want to store settings (e.g. "filter_on = true") inside a textfile. I want to use these variables for later use in the flows, for example inside a switch-node.
Currently, I am using the flow context:

So my main idea is to trigger a flow at start, where I put all these variables into the context. But I would prefer to read the values when they are used inside the flow (especially when I am working with Docker secrets). Is it possible to do this? Or do I have to create a new node for this?

Thanks in advance and have a nice weekend!

You can use ENV vars for secrets. Any where you can type ${MY_SECRET} it will get converted in the runtime to the ENV VAR value.

If you want to read/write values from file, there are contrib nodes that already exist (search the flows lib)

Is there a reason you don't want to use persistent context variables?

If you really do want to roll your own, put the data into a JS object so that you can store it as JSON (which is, I think, what the persistent context store does for you).

2 Likes

Oh, I've never heard of persistent context before^^ I will definitely try this for my non-sensitive data

Here is something that may help you understand:

Thank you :slight_smile:
This post is way more helpful than the link provided in the settings.js

1 Like

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