It is possible to change some of the n8n defaults via special environment variables.
For a full list of available configurations see Environment Variables.
How to set#
Where you set these environment variables depends on how you are running n8n, via npm or Docker.
For npm, set your desired environment variables in Terminal using the
export command as shown below:
For Docker, you can set your desired environment variables in the
n8n: environment: element of your
docker-compose.yaml file . For example:
1 2 3 4 5
Or using the
-e flag from the command line:
1 2 3 4 5 6 7
Configuration via file#
It is also possible to configure n8n using a configuration file.
Only the values that should be different from the default need to be defined in your configuration file. If needed multiple files can also be supplied. For example, you can have some generic base settings and some specific ones depending on the environment.
The path to the JSON configuration file to use can be set using the environment variable
1 2 3 4 5
A possible configuration file could look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
You can also append
_FILE to some individual environment variables to provide their configuration in a separate file, enabling you to avoid passing sensitive details via environment variables.
n8n will then load the data from the file with the given name, making it possible to easily load data from Docker- and Kubernetes-Secrets.
The following environment variables support file input:
Keep in mind
This variable only gets used when the
n8n-editor-ui package gets built manually. Hence, it does not get used in combination with the default n8n docker image. By default,
/ gets used, meaning that it uses the root-domain.
Tells the frontend how to reach the REST API of the backend.
n8n creates a random encryption key automatically on the first launch and saves
it in the
~/.n8n folder. That key is used to encrypt the credentials before
they get saved to the database. It is also possible to overwrite that key and
set it via an environment variable.
Execute in same process#
All workflows get executed in their own separate process. This ensures that all CPU cores get used and that they do not block each other on CPU intensive tasks. Additionally, this makes sure that the crash of one execution does not take down the whole application. The disadvantage is, however, that it slows down the start-time considerably and uses much more memory. So in case the workflows are not CPU intensive and they have to start very fast, it is possible to run them all directly in the main-process with this setting.
A workflow times out and gets canceled after this time (in seconds). If the workflow is executed in the main process, a soft timeout is executed (takes effect after the current node finishes). If a workflow is running in its own process, a soft timeout is tried first. The process is killed after waiting for an additional fifth of the given timeout duration.
EXECUTIONS_TIMEOUT is set to
-1. For example, if you want to set the timeout to one hour:
You can also set maximum execution time (in seconds) for each workflow individually. For example, if you want to set maximum execution time to two hours:
Custom nodes location#
Every user can add custom nodes that get loaded by n8n on startup. The default
location is in the subfolder
.n8n/custom of the user who started n8n.
Additional folders can be defined with an environment variable.
Use built-in and external modules in Function-Nodes#
For security reasons, importing modules is restricted by default in the Function-Nodes. It is, however, possible to lift that restriction for built-in and external modules by setting the following environment variables:
NODE_FUNCTION_ALLOW_BUILTIN: For builtin modules
NODE_FUNCTION_ALLOW_EXTERNAL: For external modules sourced from n8n/node_modules directory. External module support is disabled when env variable is not set.
1 2 3 4 5 6 7 8 9 10 11
The timezone is set by default to "America/New_York". For instance, it is used by the
Cron node to know at what time the workflow should be started. To set a different
default timezone, set
GENERIC_TIMEZONE to the appropriate value. For example,
if you want to set the timezone to Berlin (Germany):
You can find the name of your timezone here.
User-specific data like the encryption key, SQLite database file, and
the ID of the tunnel (if used) gets saved by default in the subfolder
.n8n of the user who started n8n. It is possible to overwrite the
user-folder via an environment variable.
The webhook URL will normally be created automatically by combining
N8N_PORT. However, if n8n runs behind a
reverse proxy that would not work. That's because n8n runs internally
on port 5678 but is exposed to the web via the reverse proxy on port 443. In
that case, it is important to set the webhook URL manually so that it can be
displayed correctly in the Editor UI and even more important is that the correct
webhook URLs get registred with the external services.
In order to collect and expose metrics, n8n uses the prom-client library.
/metrics endpoint is disabled by default, but it is possible to enable it using the
N8N_METRICS environment variable.
It is also possible to overwrite the prefix of the metric names by setting the
N8N_METRICS_PREFIX environment variable.
Note: At the moment, n8n does not support metrics for webhooks.