2019-07-21 10:47:41 -07:00
|
|
|
import * as convict from 'convict';
|
|
|
|
import * as dotenv from 'dotenv';
|
|
|
|
|
|
|
|
dotenv.config();
|
|
|
|
|
|
|
|
const config = convict({
|
|
|
|
|
|
|
|
database: {
|
|
|
|
type: {
|
|
|
|
doc: 'Type of database to use',
|
2020-04-14 10:54:11 -07:00
|
|
|
format: ['sqlite', 'mariadb', 'mongodb', 'mysqldb', 'postgresdb'],
|
2019-07-21 10:47:41 -07:00
|
|
|
default: 'sqlite',
|
|
|
|
env: 'DB_TYPE'
|
|
|
|
},
|
|
|
|
mongodb: {
|
|
|
|
connectionUrl: {
|
|
|
|
doc: 'MongoDB Connection URL',
|
|
|
|
format: '*',
|
|
|
|
default: 'mongodb://user:password@localhost:27017/database',
|
|
|
|
env: 'DB_MONGODB_CONNECTION_URL'
|
|
|
|
}
|
|
|
|
},
|
2020-03-21 10:32:26 -07:00
|
|
|
tablePrefix: {
|
|
|
|
doc: 'Prefix for table names',
|
|
|
|
format: '*',
|
|
|
|
default: '',
|
|
|
|
env: 'DB_TABLE_PREFIX'
|
|
|
|
},
|
2019-07-22 11:29:06 -07:00
|
|
|
postgresdb: {
|
|
|
|
database: {
|
|
|
|
doc: 'PostgresDB Database',
|
|
|
|
format: String,
|
|
|
|
default: 'n8n',
|
|
|
|
env: 'DB_POSTGRESDB_DATABASE'
|
|
|
|
},
|
|
|
|
host: {
|
|
|
|
doc: 'PostgresDB Host',
|
|
|
|
format: String,
|
|
|
|
default: 'localhost',
|
|
|
|
env: 'DB_POSTGRESDB_HOST'
|
|
|
|
},
|
|
|
|
password: {
|
|
|
|
doc: 'PostgresDB Password',
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'DB_POSTGRESDB_PASSWORD'
|
|
|
|
},
|
|
|
|
port: {
|
|
|
|
doc: 'PostgresDB Port',
|
|
|
|
format: Number,
|
|
|
|
default: 5432,
|
|
|
|
env: 'DB_POSTGRESDB_PORT'
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
doc: 'PostgresDB User',
|
|
|
|
format: String,
|
|
|
|
default: 'root',
|
|
|
|
env: 'DB_POSTGRESDB_USER'
|
|
|
|
},
|
2020-03-17 22:04:53 -07:00
|
|
|
schema: {
|
|
|
|
doc: 'PostgresDB Schema',
|
|
|
|
format: String,
|
|
|
|
default: 'public',
|
|
|
|
env: 'DB_POSTGRESDB_SCHEMA'
|
|
|
|
},
|
2020-06-25 02:39:04 -07:00
|
|
|
|
|
|
|
ssl: {
|
|
|
|
ca: {
|
|
|
|
doc: 'SSL certificate authority',
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'DB_POSTGRESDB_SSL_CA',
|
|
|
|
},
|
|
|
|
cert: {
|
|
|
|
doc: 'SSL certificate',
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'DB_POSTGRESDB_SSL_CERT',
|
|
|
|
},
|
|
|
|
key: {
|
|
|
|
doc: 'SSL key',
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'DB_POSTGRESDB_SSL_KEY',
|
|
|
|
},
|
|
|
|
rejectUnauthorized: {
|
|
|
|
doc: 'If unauthorized SSL connections should be rejected',
|
|
|
|
format: 'Boolean',
|
|
|
|
default: true,
|
|
|
|
env: 'DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-07-22 11:29:06 -07:00
|
|
|
},
|
2020-02-10 08:09:06 -08:00
|
|
|
mysqldb: {
|
|
|
|
database: {
|
|
|
|
doc: 'MySQL Database',
|
|
|
|
format: String,
|
|
|
|
default: 'n8n',
|
|
|
|
env: 'DB_MYSQLDB_DATABASE'
|
|
|
|
},
|
|
|
|
host: {
|
|
|
|
doc: 'MySQL Host',
|
|
|
|
format: String,
|
|
|
|
default: 'localhost',
|
|
|
|
env: 'DB_MYSQLDB_HOST'
|
|
|
|
},
|
|
|
|
password: {
|
|
|
|
doc: 'MySQL Password',
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'DB_MYSQLDB_PASSWORD'
|
|
|
|
},
|
|
|
|
port: {
|
|
|
|
doc: 'MySQL Port',
|
|
|
|
format: Number,
|
2020-02-10 08:18:28 -08:00
|
|
|
default: 3306,
|
2020-02-10 08:09:06 -08:00
|
|
|
env: 'DB_MYSQLDB_PORT'
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
doc: 'MySQL User',
|
|
|
|
format: String,
|
|
|
|
default: 'root',
|
|
|
|
env: 'DB_MYSQLDB_USER'
|
|
|
|
},
|
2019-07-22 11:29:06 -07:00
|
|
|
},
|
2019-07-21 10:47:41 -07:00
|
|
|
},
|
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
credentials: {
|
|
|
|
overwrite: {
|
2020-07-07 10:03:53 -07:00
|
|
|
data: {
|
|
|
|
// Allows to set default values for credentials which
|
|
|
|
// get automatically prefilled and the user does not get
|
|
|
|
// displayed and can not change.
|
|
|
|
// Format: { CREDENTIAL_NAME: { PARAMTER: VALUE }}
|
|
|
|
doc: 'Overwrites for credentials',
|
|
|
|
format: '*',
|
|
|
|
default: '{}',
|
|
|
|
env: 'CREDENTIALS_OVERWRITE_DATA'
|
|
|
|
},
|
|
|
|
endpoint: {
|
|
|
|
doc: 'Fetch credentials from API',
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'CREDENTIALS_OVERWRITE_ENDPOINT',
|
|
|
|
},
|
|
|
|
},
|
2020-01-25 23:48:38 -08:00
|
|
|
},
|
|
|
|
|
2019-07-21 10:47:41 -07:00
|
|
|
executions: {
|
2020-01-17 17:49:31 -08:00
|
|
|
|
|
|
|
// By default workflows get always executed in their own process.
|
|
|
|
// If this option gets set to "main" it will run them in the
|
|
|
|
// main-process instead.
|
|
|
|
process: {
|
|
|
|
doc: 'In what process workflows should be executed',
|
|
|
|
format: ['main', 'own'],
|
|
|
|
default: 'own',
|
|
|
|
env: 'EXECUTIONS_PROCESS'
|
|
|
|
},
|
|
|
|
|
2019-07-21 10:47:41 -07:00
|
|
|
// If a workflow executes all the data gets saved by default. This
|
|
|
|
// could be a problem when a workflow gets executed a lot and processes
|
|
|
|
// a lot of data. To not write the database full it is possible to
|
|
|
|
// not save the execution at all.
|
|
|
|
// Depending on if the execution did succeed or error a different
|
|
|
|
// save behaviour can be set.
|
|
|
|
saveDataOnError: {
|
|
|
|
doc: 'What workflow execution data to save on error',
|
|
|
|
format: ['all', 'none'],
|
|
|
|
default: 'all',
|
|
|
|
env: 'EXECUTIONS_DATA_SAVE_ON_ERROR'
|
|
|
|
},
|
|
|
|
saveDataOnSuccess: {
|
|
|
|
doc: 'What workflow execution data to save on success',
|
|
|
|
format: ['all', 'none'],
|
|
|
|
default: 'all',
|
|
|
|
env: 'EXECUTIONS_DATA_SAVE_ON_SUCCESS'
|
|
|
|
},
|
|
|
|
|
|
|
|
// If the executions of workflows which got started via the editor
|
|
|
|
// should be saved. By default they will not be saved as this runs
|
|
|
|
// are normally only for testing and debugging. This setting can
|
|
|
|
// also be overwritten on a per workflow basis in the workflow settings
|
|
|
|
// in the editor.
|
|
|
|
saveDataManualExecutions: {
|
|
|
|
doc: 'Save data of executions when started manually via editor',
|
|
|
|
default: false,
|
|
|
|
env: 'EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
generic: {
|
|
|
|
// The timezone to use. Is important for nodes like "Cron" which start the
|
|
|
|
// workflow automatically at a specified time. This setting can also be
|
|
|
|
// overwritten on a per worfklow basis in the workflow settings in the
|
|
|
|
// editor.
|
|
|
|
timezone: {
|
|
|
|
doc: 'The timezone to use',
|
|
|
|
format: '*',
|
|
|
|
default: 'America/New_York',
|
|
|
|
env: 'GENERIC_TIMEZONE'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// How n8n can be reached (Editor & REST-API)
|
|
|
|
host: {
|
|
|
|
format: String,
|
|
|
|
default: 'localhost',
|
|
|
|
arg: 'host',
|
|
|
|
env: 'N8N_HOST',
|
|
|
|
doc: 'Host name n8n can be reached'
|
|
|
|
},
|
|
|
|
port: {
|
|
|
|
format: Number,
|
|
|
|
default: 5678,
|
|
|
|
arg: 'port',
|
|
|
|
env: 'N8N_PORT',
|
|
|
|
doc: 'HTTP port n8n can be reached'
|
|
|
|
},
|
2020-06-04 00:36:10 -07:00
|
|
|
listen_address: {
|
|
|
|
format: String,
|
|
|
|
default: '0.0.0.0',
|
|
|
|
env: 'N8N_LISTEN_ADDRESS',
|
|
|
|
doc: 'IP address n8n should listen on'
|
|
|
|
},
|
2019-07-21 10:47:41 -07:00
|
|
|
protocol: {
|
|
|
|
format: ['http', 'https'],
|
|
|
|
default: 'http',
|
|
|
|
env: 'N8N_PROTOCOL',
|
|
|
|
doc: 'HTTP Protocol via which n8n can be reached'
|
|
|
|
},
|
2020-03-27 10:19:30 -07:00
|
|
|
ssl_key: {
|
|
|
|
format: String,
|
2020-03-30 04:29:42 -07:00
|
|
|
default: '',
|
2020-03-27 10:19:30 -07:00
|
|
|
env: 'N8N_SSL_KEY',
|
|
|
|
doc: 'SSL Key for HTTPS Protocol'
|
|
|
|
},
|
|
|
|
ssl_cert: {
|
|
|
|
format: String,
|
2020-03-30 04:29:42 -07:00
|
|
|
default: '',
|
2020-03-27 10:19:30 -07:00
|
|
|
env: 'N8N_SSL_CERT',
|
|
|
|
doc: 'SSL Cert for HTTPS Protocol'
|
|
|
|
},
|
2019-07-21 10:47:41 -07:00
|
|
|
|
2019-08-04 05:24:48 -07:00
|
|
|
security: {
|
|
|
|
basicAuth: {
|
|
|
|
active: {
|
|
|
|
format: 'Boolean',
|
|
|
|
default: false,
|
|
|
|
env: 'N8N_BASIC_AUTH_ACTIVE',
|
|
|
|
doc: 'If basic auth should be activated for editor and REST-API'
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'N8N_BASIC_AUTH_USER',
|
|
|
|
doc: 'The name of the basic auth user'
|
|
|
|
},
|
|
|
|
password: {
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'N8N_BASIC_AUTH_PASSWORD',
|
|
|
|
doc: 'The password of the basic auth user'
|
|
|
|
},
|
2019-10-14 13:37:51 -07:00
|
|
|
},
|
|
|
|
jwtAuth: {
|
|
|
|
active: {
|
|
|
|
format: 'Boolean',
|
|
|
|
default: false,
|
|
|
|
env: 'N8N_JWT_AUTH_ACTIVE',
|
|
|
|
doc: 'If JWT auth should be activated for editor and REST-API'
|
|
|
|
},
|
|
|
|
jwtHeader: {
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'N8N_JWT_AUTH_HEADER',
|
|
|
|
doc: 'The request header containing a signed JWT'
|
|
|
|
},
|
|
|
|
jwksUri: {
|
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'N8N_JWKS_URI',
|
|
|
|
doc: 'The URI to fetch JWK Set for JWT auh'
|
|
|
|
},
|
2019-08-04 05:24:48 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-07-21 10:47:41 -07:00
|
|
|
endpoints: {
|
|
|
|
rest: {
|
|
|
|
format: String,
|
|
|
|
default: 'rest',
|
|
|
|
env: 'N8N_ENDPOINT_REST',
|
|
|
|
doc: 'Path for rest endpoint'
|
|
|
|
},
|
|
|
|
webhook: {
|
|
|
|
format: String,
|
|
|
|
default: 'webhook',
|
|
|
|
env: 'N8N_ENDPOINT_WEBHOOK',
|
|
|
|
doc: 'Path for webhook endpoint'
|
|
|
|
},
|
|
|
|
webhookTest: {
|
|
|
|
format: String,
|
|
|
|
default: 'webhook-test',
|
|
|
|
env: 'N8N_ENDPOINT_WEBHOOK_TEST',
|
|
|
|
doc: 'Path for test-webhook endpoint'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-05-03 23:56:01 -07:00
|
|
|
externalHookFiles: {
|
2020-05-04 16:23:54 -07:00
|
|
|
doc: 'Files containing external hooks. Multiple files can be separated by colon (":")',
|
2020-05-03 23:56:01 -07:00
|
|
|
format: String,
|
|
|
|
default: '',
|
|
|
|
env: 'EXTERNAL_HOOK_FILES'
|
|
|
|
},
|
|
|
|
|
2019-07-21 10:47:41 -07:00
|
|
|
nodes: {
|
|
|
|
exclude: {
|
|
|
|
doc: 'Nodes not to load',
|
|
|
|
format: function check(rawValue) {
|
|
|
|
try {
|
|
|
|
const values = JSON.parse(rawValue);
|
|
|
|
if (!Array.isArray(values)) {
|
|
|
|
throw new Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const value of values) {
|
|
|
|
if (typeof value !== 'string') {
|
|
|
|
throw new Error();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
throw new TypeError(`The Nodes to exclude is not a valid Array of strings.`);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
default: '[]',
|
|
|
|
env: 'NODES_EXCLUDE'
|
|
|
|
},
|
|
|
|
errorTriggerType: {
|
|
|
|
doc: 'Node Type to use as Error Trigger',
|
|
|
|
format: String,
|
|
|
|
default: 'n8n-nodes-base.errorTrigger',
|
|
|
|
env: 'NODES_ERROR_TRIGGER_TYPE'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2020-03-27 04:30:42 -07:00
|
|
|
// Overwrite default configuration with settings which got defined in
|
|
|
|
// optional configuration files
|
|
|
|
if (process.env.N8N_CONFIG_FILES !== undefined) {
|
2020-03-29 03:46:55 -07:00
|
|
|
const configFiles = process.env.N8N_CONFIG_FILES.split(',');
|
|
|
|
console.log(`\nLoading configuration overwrites from:\n - ${configFiles.join('\n - ')}\n`);
|
2020-03-27 04:30:42 -07:00
|
|
|
|
2020-03-29 03:46:55 -07:00
|
|
|
config.loadFile(configFiles);
|
2020-03-27 04:30:42 -07:00
|
|
|
}
|
|
|
|
|
2019-07-21 10:47:41 -07:00
|
|
|
config.validate({
|
|
|
|
allowed: 'strict',
|
|
|
|
});
|
|
|
|
|
|
|
|
export = config;
|