mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
✨ Add support for n8n configuration via file
This commit is contained in:
parent
45ee6472de
commit
764172d46f
|
@ -177,3 +177,52 @@ webhook URLs get registred with external services.
|
|||
```bash
|
||||
export WEBHOOK_TUNNEL_URL="https://n8n.example.com/"
|
||||
```
|
||||
|
||||
|
||||
## Configuration via file
|
||||
|
||||
It is also possible to configure n8n via a configuration file.
|
||||
|
||||
It is not necessary to define all values. Only the ones which should be
|
||||
different from the defaults.
|
||||
|
||||
If needed also multiple files can be supplied to for example have generic
|
||||
base settings and some specific ones depending on the environment.
|
||||
|
||||
The path to the JSON configuration file to use can be set via the environment
|
||||
variable `N8N_CONFIG_FILES`.
|
||||
|
||||
```bash
|
||||
# Single file
|
||||
export N8N_CONFIG_FILES=/folder/my-config.json
|
||||
|
||||
# Multiple files can be comma-separated
|
||||
export N8N_CONFIG_FILES=/folder/my-config.json,/folder/production.json
|
||||
```
|
||||
|
||||
A possible configuration file could look like this:
|
||||
```json
|
||||
{
|
||||
"executions": {
|
||||
"process": "main",
|
||||
"saveDataOnSuccess": "none"
|
||||
},
|
||||
"generic": {
|
||||
"timezone": "Europe/Berlin"
|
||||
},
|
||||
"security": {
|
||||
"basicAuth": {
|
||||
"active": true,
|
||||
"user": "frank",
|
||||
"password": "some-secure-password"
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"exclude": "[\"n8n-nodes-base.executeCommand\",\"n8n-nodes-base.writeBinaryFile\"]"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
All possible values which can be set and their defaults can be found here:
|
||||
|
||||
[https://github.com/n8n-io/n8n/blob/master/packages/cli/config/index.ts](https://github.com/n8n-io/n8n/blob/master/packages/cli/config/index.ts)
|
||||
|
|
|
@ -273,6 +273,15 @@ const config = convict({
|
|||
|
||||
});
|
||||
|
||||
// Overwrite default configuration with settings which got defined in
|
||||
// optional configuration files
|
||||
if (process.env.N8N_CONFIG_FILES !== undefined) {
|
||||
const configFiles = process.env.N8N_CONFIG_FILES.split(',');
|
||||
console.log(`\nLoading configuration overwrites from:\n - ${configFiles.join('\n - ')}\n`);
|
||||
|
||||
config.loadFile(configFiles);
|
||||
}
|
||||
|
||||
config.validate({
|
||||
allowed: 'strict',
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue