v12.0.0 - initial commit
This commit is contained in:
commit
e2c49ea43c
1145 changed files with 97211 additions and 0 deletions
44
packages/server/lib/environment-helper.js
Normal file
44
packages/server/lib/environment-helper.js
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
const path = require('path')
|
||||
|
||||
const isDevMode = () => process.env.NODE_ENV === 'development'
|
||||
const isProdMode = () => process.env.NODE_ENV === 'production'
|
||||
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../.env') })
|
||||
|
||||
function isRemoteNode(crypto) {
|
||||
return process.env[`${crypto.cryptoCode}_NODE_LOCATION`] === 'remote'
|
||||
}
|
||||
|
||||
function isRemoteWallet(crypto) {
|
||||
return process.env[`${crypto.cryptoCode}_WALLET_LOCATION`] === 'remote'
|
||||
}
|
||||
|
||||
const skip2fa = process.env.SKIP_2FA === 'true'
|
||||
|
||||
function getCustomTextEntries() {
|
||||
const customTextEntries = []
|
||||
|
||||
Object.keys(process.env).forEach(key => {
|
||||
if (key.startsWith('CUSTOM_TEXT_')) {
|
||||
const id = key
|
||||
.replace('CUSTOM_TEXT_', '')
|
||||
.toLowerCase()
|
||||
.replace(/_/g, '-')
|
||||
const text = process.env[key]
|
||||
if (text) {
|
||||
customTextEntries.push({ id, text })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return customTextEntries
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isDevMode,
|
||||
isProdMode,
|
||||
isRemoteNode,
|
||||
isRemoteWallet,
|
||||
skip2fa,
|
||||
getCustomTextEntries,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue