Merge pull request #93 from poanetwork/ui-test-env

UI - New way of getting env variables
This commit is contained in:
Alexander Kolotov 2019-06-07 17:54:49 +03:00 committed by GitHub
commit a669ea622c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 25 additions and 55 deletions

@ -58,9 +58,6 @@ jobs:
test: test:
docker: docker:
- image: circleci/node:10.15 - image: circleci/node:10.15
environment:
HOME_RPC_URL: http://example.com
FOREIGN_RPC_URL: http://example.com
steps: steps:
- restore_cache: - restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }} key: initialize-{{ .Environment.CIRCLE_SHA1 }}

@ -1,4 +1,3 @@
require('dotenv').config()
const baseConfig = require('./base.config') const baseConfig = require('./base.config')
const erc20Abi = require('../../contracts/build/contracts/ERC20').abi const erc20Abi = require('../../contracts/build/contracts/ERC20').abi
const { ERC_TYPES } = require('../src/utils/constants') const { ERC_TYPES } = require('../src/utils/constants')

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

@ -1,4 +1,3 @@
require('dotenv').config()
const baseConfig = require('./base.config') const baseConfig = require('./base.config')
const { web3Foreign } = require('../src/services/web3') const { web3Foreign } = require('../src/services/web3')

@ -1,4 +1,3 @@
require('dotenv').config()
const baseConfig = require('./base.config') const baseConfig = require('./base.config')
const { web3Home } = require('../src/services/web3') const { web3Home } = 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('../../env')
require('dotenv').config({
path: path.join(__dirname, '../../.env')
})
const Web3 = require('web3') const Web3 = require('web3')
const Web3Utils = require('web3-utils') const Web3Utils = require('web3-utils')
const rpcUrlsManager = require('../../src/services/getRpcUrlsManager') const rpcUrlsManager = require('../../src/services/getRpcUrlsManager')

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,4 +1,4 @@
require('dotenv').config() require('../env')
const path = require('path') const path = require('path')
const { connectSenderToQueue } = require('./services/amqpClient') const { connectSenderToQueue } = require('./services/amqpClient')
const { redis, redlock } = require('./services/redisClient') 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 connection = require('amqp-connection-manager').connect(process.env.QUEUE_URL)
const logger = require('./logger') const logger = require('./logger')

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

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