Development and Production flow and environment variables

Hi to everyone :slight_smile:

When i generate a workflow, i normally set up some HTTP Nodes to do requests to our server just like an api request. This type of HTTP Requests may require to be called many times in a single workflow, with various url for many reason. An example would be to first call the server to get a list of items, and then for each items, send a message.

So in this case, i set up an HTTP node to call our server to read the items, and another HTTP node to call our server to send those items. Both of nodes are HTTP nodes in this case, and they both have their own url to call, with specific parameter, header authorization, etc.

My question is: is there any way to differentiate between develop and production? So for example when i am generating a new workflow i need some data that is the same for every HTTP request (a user id, an authorization header, and so on)…

At the moment i have found a ‘dirty’ solution by adding to my workflow two SET nodes, one for develop environment variables, and one for production environment variables. Is there a better way to setup this difference between environments?

With this help, i would not have anymore need to change manually every HTTP request node by getting the ‘environment variables’ from the SET dev node or SET prod node.

Hi @Sengerio

I was thinking about a way to do this today.
There is no easy way I think. You would have to set some kind of way to retrieve the correct credentials.
You could for example do some n8n goodness and use the API and such to set the credentials when it is “pushed to production” for example using tags to make sure you can easily check the workflows and needed credentials.
To be clear, a n8n flow checking workflows and changing credentials to production credentials when needed.

Hope that makes sense.