forked from harmony-one/contract-verification-service
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenv.js
More file actions
32 lines (25 loc) · 755 Bytes
/
env.js
File metadata and controls
32 lines (25 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
const fs = require('fs');
const path = require('path');
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
const NODE_ENV = process.env.NODE_ENV || 'mainnet';
if (!process.env.NODE_ENV) {
console.warn('NODE ENV is not specified. Set to production');
}
var dotenvFiles = [
`${resolveApp('.env')}`,
`${resolveApp('.env.common')}`,
`${resolveApp('.env')}.${NODE_ENV}`,
resolveApp('./keys/.env.private'),
].filter(Boolean);
console.log('dotenvFiles', dotenvFiles);
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv-expand')(
require('dotenv').config({
path: dotenvFile,
})
);
}
});