mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
refactor(core): Load dotenv as early as possible (no-changelog) (#10948)
This commit is contained in:
parent
5ce05b33d2
commit
afbe884dad
|
@ -43,6 +43,13 @@ require('express-async-errors');
|
|||
require('source-map-support').install();
|
||||
require('reflect-metadata');
|
||||
|
||||
// Skip loading dotenv in e2e tests.
|
||||
// Also, do not use `inE2ETests` from constants here, because that'd end up code that might read from `process.env` before the values are loaded from an `.env` file.
|
||||
if (process.env.E2E_TESTS !== 'true') {
|
||||
// Loading dotenv early ensures that `process.env` is up-to-date everywhere in code
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
if (process.env.NODEJS_PREFER_IPV4 === 'true') {
|
||||
require('dns').setDefaultResultOrder('ipv4first');
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { GlobalConfig } from '@n8n/config';
|
||||
import convict from 'convict';
|
||||
import dotenv from 'dotenv';
|
||||
import { flatten } from 'flat';
|
||||
import { readFileSync } from 'fs';
|
||||
import merge from 'lodash/merge';
|
||||
|
@ -22,8 +21,6 @@ if (inE2ETests) {
|
|||
process.env.N8N_PUBLIC_API_DISABLED = 'true';
|
||||
process.env.SKIP_STATISTICS_EVENTS = 'true';
|
||||
process.env.N8N_SECURE_COOKIE = 'false';
|
||||
} else {
|
||||
dotenv.config();
|
||||
}
|
||||
|
||||
// Load schema after process.env has been overwritten
|
||||
|
|
Loading…
Reference in a new issue