How to modify environment variables inside n8n?


I would like to know how I can modify the environment variables within n8n. In my case I have my n8n in Docker but I don’t know how to enter to modify my variables.

Below I share what I need to do

  • Modify the url of my Webhook node, since the url appears to me as http and not as https. This causes me more problems with other nodes such as google, since to register a url in the google console it must be https.
  • Create an environment variable that I can query from my different workflows. This so that when you need to make a change you can do it from the environment variable and not flow by flow.

I would greatly appreciate your help :yum:

Hi @OSCAR_EDUARDO_SANTA, for the first part you probably want to set WEBHOOK_URL permanently to your https URL if you have a valid SSL certificate in front of n8n. No need to this inside of n8n.

For the second question you might want so consider alternatives as well. This is because Docker doesn’t allow updating environment variables insider a running container from the looks of it. So, you would need to change your env file in n8n, then have n8n restart its own container (I think, not sure if this exactually possible). This Stack Overflow post discusses the problem if you’re curious:

Perhaps you want to consider using a database (such as Baserow) to store and query data from different workflows?


Thank you very much for your answer

About the first question:
How could I do to use other nodes like google since the url is http and google requests https. Attached is an example of how it generates the urls.


About the second question
I’m new to docker, just recently started using it and not very familiar with it. I would like to know how I enter the env file. Now by defining the variables as from a stream in n8n I can query that variable.

I am very attentive, thank you very much.

How exactly do you run n8n using docker? Are you using a docker run command or a docker compose file?

For the docker run command you could, for example, add an environment variable using the -e parameter. So instead of docker run -it --rm --name n8n -v ~/.n8n:/home/node/.n8n -p 5678:5678 n8nio/n8n:latest you would do this:

docker run -it --rm --name n8n -v ~/.n8n:/home/node/.n8n -e WEBHOOK_URL= -p 5678:5678 n8nio/n8n:latest

All relevant environment variables are documented here.

In case you’re using docker compose you would add the respective variable under the environment section of your docker compose file.

1 Like


Thank you very much for your help, it has helped me a lot. I just wanted to ask you one more question, how can I query these variables inside my n8n in order to use them in my flows.

Here is my use case.

Create a variable containing different IP addresses. For example, if inside the execution of the flow one of these IP addresses is evidenced the flow will continue executing otherwise it will terminate. We believe that this alternative is the best for one reason: We could use this variable in several workflows and in case of changing any IP address it would only change within the variable and not in each of the flows that we are going to program.

I would appreciate if you could tell me if this alternative is the best or there is another way to do it within n8n.

I remain very attentive thank you very much.