Introduced new way of getting env variables

This commit is contained in:
rzadp 2019-06-07 13:19:12 +02:00
parent 1dba07623d
commit 9285ac534e
21 changed files with 25 additions and 49 deletions

@ -1,4 +1,4 @@
require('dotenv').config()
require('../env')
const { toBN } = require('web3').utils
const { web3Home, web3Foreign } = require('../src/services/web3')

4
oracle/env.js Normal file

@ -0,0 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, process.env.NODE_ENV === 'test' ? './test/test.env' : './.env')
})

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../../.env')
})
require('../../env')
const Web3 = require('web3')
const Web3Utils = require('web3-utils')
const rpcUrlsManager = require('../../src/services/getRpcUrlsManager')

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../../.env')
})
require('../../env')
const Web3 = require('web3')
const Web3Utils = require('web3-utils')
const rpcUrlsManager = require('../../src/services/getRpcUrlsManager')

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../../.env')
})
require('../../env')
const Web3 = require('web3')
const Web3Utils = require('web3-utils')
const rpcUrlsManager = require('../../src/services/getRpcUrlsManager')

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../../.env')
})
require('../../env')
const Web3Utils = require('web3-utils')
const { web3Home } = require('../../src/services/web3')
const { sendTx, sendRawTx } = require('../../src/tx/sendTx')

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../.env')
})
require('../env')
const Web3 = require('web3')
const bridgeValidatorsABI = require('../../contracts/build/contracts/BridgeValidators').abi

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../.env')
})
require('../env')
const Web3 = require('web3')
const ERC677BridgeTokenABI = require('../../contracts/build/contracts/ERC677BridgeToken').abi
const { ERC_TYPES } = require('../src/utils/constants')

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../../.env')
})
require('../../env')
const Web3Utils = require('web3-utils')
const { web3Foreign } = require('../../src/services/web3')
const { sendTx, sendRawTx } = require('../../src/tx/sendTx')

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../../.env')
})
require('../../env')
const Web3Utils = require('web3-utils')
const { web3Home } = require('../../src/services/web3')
const { sendTx, sendRawTx } = require('../../src/tx/sendTx')

@ -1,7 +1,4 @@
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '..', '.env')
})
require('../env')
const { privateKeyToAddress } = require('../src/utils/utils')
const { EXIT_CODES } = require('../src/utils/constants')

@ -1,8 +1,5 @@
require('../env')
const Redis = require('ioredis')
const path = require('path')
require('dotenv').config({
path: path.join(__dirname, '../.env')
})
const { id } = require('../config/base.config')
const { EXIT_CODES } = require('../src/utils/constants')

@ -1,4 +1,4 @@
require('dotenv').config()
require('../../../env')
const promiseLimit = require('promise-limit')
const { HttpListProviderError } = require('http-list-provider')
const rootLogger = require('../../services/logger')

@ -1,4 +1,4 @@
require('dotenv').config()
require('../../../env')
const promiseLimit = require('promise-limit')
const { HttpListProviderError } = require('http-list-provider')
const bridgeValidatorsABI = require('../../../../contracts/build/contracts/BridgeValidators').abi

@ -1,4 +1,4 @@
require('dotenv').config()
require('../../../env')
const promiseLimit = require('promise-limit')
const { HttpListProviderError } = require('http-list-provider')
const bridgeValidatorsABI = require('../../../../contracts/build/contracts/BridgeValidators').abi

@ -1,4 +1,4 @@
require('dotenv').config()
require('../../../env')
const promiseLimit = require('promise-limit')
const { HttpListProviderError } = require('http-list-provider')
const bridgeValidatorsABI = require('../../../../contracts/build/contracts/BridgeValidators').abi

@ -1,4 +1,4 @@
require('dotenv').config()
require('../env')
const path = require('path')
const { connectSenderToQueue } = require('./services/amqpClient')
const { redis, redlock } = require('./services/redisClient')

@ -1,4 +1,4 @@
require('dotenv').config()
require('../../env')
const connection = require('amqp-connection-manager').connect(process.env.QUEUE_URL)
const logger = require('./logger')

@ -1,4 +1,4 @@
require('dotenv').config()
require('../../env')
const fetch = require('node-fetch')
const Web3Utils = require('web3-utils')
const { web3Home, web3Foreign } = require('../services/web3')

@ -1,4 +1,4 @@
require('dotenv').config()
require('../env')
const path = require('path')
const { BN, toBN } = require('web3').utils
const { connectWatcherToQueue, connection } = require('./services/amqpClient')

2
oracle/test/test.env Normal file

@ -0,0 +1,2 @@
HOME_RPC_URL=http://example.com
FOREIGN_RPC_URL=http://example.com