Fix: use env var on production
This commit is contained in:
parent
da7cfd02b0
commit
c2c44f8ef9
1 changed files with 8 additions and 10 deletions
|
|
@ -1,24 +1,22 @@
|
||||||
const https = require('https')
|
const https = require('https')
|
||||||
const BN = require('../../../bn')
|
const BN = require('../../../bn')
|
||||||
const E = require('../../../error')
|
const E = require('../../../error')
|
||||||
|
const _ = require('lodash/fp')
|
||||||
|
|
||||||
|
const ENV = process.env.NODE_ENV === undefined || process.env.NODE_ENV === 'development' ? 'development' : 'production'
|
||||||
|
const SUPPORTED_COINS = ['BTC', 'ZEC', 'LTC', 'BCH', 'DASH', 'ETH']
|
||||||
|
|
||||||
const axios = require('axios').create({
|
const axios = require('axios').create({
|
||||||
// TODO: get rejectUnauthorized true to work
|
// TODO: get rejectUnauthorized true to work
|
||||||
baseURL: 'https://localhost:5555/api/',
|
baseURL: ENV === 'development' ? 'https://localhost:5555/api/' : process.env.PAZUZ_API_WALLET_URL,
|
||||||
httpsAgent: new https.Agent({
|
httpsAgent: new https.Agent({
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const SUPPORTED_COINS = ['BTC', 'ZEC', 'LTC', 'BCH', 'DASH', 'ETH']
|
const checkCryptoCode = (cryptoCode) => !_.includes(cryptoCode, SUPPORTED_COINS)
|
||||||
|
? Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
|
||||||
function checkCryptoCode (cryptoCode) {
|
: Promise.resolve()
|
||||||
if (!SUPPORTED_COINS.includes(cryptoCode)) {
|
|
||||||
return Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.resolve()
|
|
||||||
}
|
|
||||||
|
|
||||||
function balance (account, cryptoCode, settings, operatorId) {
|
function balance (account, cryptoCode, settings, operatorId) {
|
||||||
return checkCryptoCode(cryptoCode)
|
return checkCryptoCode(cryptoCode)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue