#252 reorganise .env

This commit is contained in:
Avris 2021-09-07 19:11:15 +02:00
parent d28553eddc
commit 5edff7eb59
7 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,5 @@
require('./src/dotenv')();
import { loadSuml } from './server/loader';
import fs from 'fs';
import {buildDict, buildList, buildLocaleList} from "./src/helpers";

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path:__dirname + '/../.env' });
require('../src/dotenv')();
const Pageres = require('pageres');
const fs = require('fs');
const Suml = require('suml');

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path:__dirname + '/../.env' });
require('../src/dotenv')();
const Pageres = require('pageres');
const isHighLoadTime = require('./overload');
const dbConnection = require('./db');

View File

@ -1,5 +1,6 @@
require('../src/dotenv')();
const dbConnection = require('./db');
require('dotenv').config({ path:__dirname + '/../.env' });
const awsConfig = require('./aws');
const S3 = require('aws-sdk/clients/s3');

View File

@ -1,5 +1,6 @@
require('../src/dotenv')();
const dbConnection = require('./db');
require('dotenv').config({ path:__dirname + '/../.env' });
const mailer = require('../src/mailer');
// TODO duplication...

View File

@ -1,5 +1,6 @@
require('../src/dotenv')();
const dbConnection = require('./db');
require('dotenv').config({ path:__dirname + '/../.env' });
const {calculateStats, statsFile} = require('../src/stats');
const locales = require('../src/locales');
const fs = require('fs');

8
src/dotenv.js Normal file
View File

@ -0,0 +1,8 @@
const dotenv = require('dotenv');
module.exports = () => {
dotenv.config({ path:__dirname + '/../.env' });
if (process.env.__INCLUDE) {
dotenv.config({ path:__dirname + '/../' + process.env.__INCLUDE });
}
}