Skip to content
Snippets Groups Projects
Commit ec2c31aa authored by michael.minelli's avatar michael.minelli
Browse files

InitialImport => Only load env vars on first process (load for all processes)

parent 38e2a968
No related branches found
No related tags found
No related merge requests found
Pipeline #26876 passed
import path from 'node:path';
import path from 'node:path';
import cluster from 'node:cluster';
if ( process.env.NODE_ENV && process.env.NODE_ENV === 'production' ) {
const myEnv = require('dotenv').config();
require('dotenv-expand').expand(myEnv);
} else {
require('dotenv').config({ path: path.join(__dirname, '../.env.keys') });
const myEnv = require('dotenv').config({ DOTENV_KEY: process.env.DOTENV_KEY_DEVELOPMENT });
require('dotenv-expand').expand(myEnv);
if ( cluster.isPrimary ) {
if ( process.env.NODE_ENV && process.env.NODE_ENV === 'production' ) {
const myEnv = require('dotenv').config();
require('dotenv-expand').expand(myEnv);
} else {
require('dotenv').config({ path: path.join(__dirname, '../.env.keys') });
const myEnv = require('dotenv').config({ DOTENV_KEY: process.env.DOTENV_KEY_DEVELOPMENT });
require('dotenv-expand').expand(myEnv);
}
}
require('./shared/helpers/TypeScriptExtensions'); // ATTENTION : This line MUST be after the dotenv.config() calls
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment