mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 00:24:07 -08:00
29 lines
709 B
TypeScript
29 lines
709 B
TypeScript
/* eslint-disable @typescript-eslint/unbound-method */
|
|
/* eslint-disable no-console */
|
|
import convict from 'convict';
|
|
import dotenv from 'dotenv';
|
|
import { schema } from './schema';
|
|
|
|
dotenv.config();
|
|
|
|
const config = convict(schema);
|
|
|
|
config.getEnv = config.get;
|
|
|
|
// 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(',');
|
|
if (process.env.NODE_ENV !== 'test') {
|
|
console.log(`\nLoading configuration overwrites from:\n - ${configFiles.join('\n - ')}\n`);
|
|
}
|
|
|
|
config.loadFile(configFiles);
|
|
}
|
|
|
|
config.validate({
|
|
allowed: 'strict',
|
|
});
|
|
|
|
export = config;
|