Configuration#
You can change n8n's settings using environment variables. For a full list of available configurations see Environment Variables.
Set environment variables by command line#
npm#
For npm, set your desired environment variables in terminal using the export
command as shown below:
1 |
|
Docker#
In Docker you can use the -e
flag from the command line:
1 2 3 4 5 |
|
Set environment variables using a file#
You can also configure n8n using a configuration file.
Only define the values that need to be different from the default in your configuration file. You can use multiple files. For example, you can have a file with generic base settings, and files with specific values for different environments.
npm#
Set the path to the JSON configuration file using the environment variable N8N_CONFIG_FILES
:
1 2 3 4 5 6 7 8 |
|
Example file:
1 2 3 4 5 6 7 8 9 10 11 |
|
Formatting as JSON
You can't always work out the correct JSON from the Environment variables reference. For example, to set N8N_METRICS
to true
, you need to do:
1 2 3 4 5 6 7 |
|
Refer to the Schema file in the source code for full details of the expected settings.
Docker#
In Docker, you can set your environment variables in the n8n: environment:
element of your docker-compose.yaml
file.
For example:
1 2 3 |
|
Keeping sensitive data in separate files#
You can append _FILE
to individual environment variables to provide their configuration in a separate file, enabling you to avoid passing sensitive details using environment variables. n8n loads the data from the file with the given name, making it possible to load data from Docker-Secrets and Kubernetes-Secrets.
Refer to Environment variables for details on each variable.
While most environment variables can use the _FILE
suffix, it's more beneficial for sensitive data such as credentials and database configuration. Here are some examples:
1 2 3 4 5 6 7 8 9 10 11 12 |
|