Skip to content

Commit

Permalink
env configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrunic committed May 6, 2018
1 parent 9ca3c35 commit b73cc0e
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@ BACKEND_CONTAINER_NAME=backend
BACKEND_PORT=3000

ETHEREUM_RPC_CONTAINER_NAME=ethereum-rpc
ETHEREUM_NETWORK_HOST=ethereum
ETHEREUM_NETWORK_ID=666
ETHEREUM_NETWORK_PORT=8545
ETHEREUM_NETWORK_EXPOSED_PORT=8545


#deployment
ROPSTEN_MNEMONIC=
INFURA_ACCESS_TOKEN=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ typings/

# dotenv environment variables file

installed_contracts
build

### Windows ###
# Windows thumbnail cache files
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ FROM node:carbon-alpine
RUN apk add --update git python make g++ && \
rm -rf /tmp/* /var/cache/apk/*

RUN npm install -g [email protected]

WORKDIR /usr/app

# Install node dependencies - done in a separate step so Docker can cache it.
Expand Down
2 changes: 1 addition & 1 deletion backend/config/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dotenv.config();
const env = process.env;

const networkHost = env.ETHEREUM_NETWORK_HOST || 'ethereum';
const networkPort = env.ETHEREUM_NETWORK_PORT || 8545;
const networkPort = 8545;

export default class Web3Config {

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
container_name: "${ETHEREUM_RPC_CONTAINER_NAME:-ethereum-rpc}"
command: ganache-cli -i ${ETHEREUM_NETWORK_ID:-666}
ports:
- "${ETHEREUM_NETWORK_PORT:-8545}:8545"
- "${ETHEREUM_NETWORK_EXPOSED_PORT:-8545}:8545"
volumes:
node_modules:
contracts:
Expand Down
6 changes: 6 additions & 0 deletions mocha-smart-contracts-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "./test-results/test-contract-results.xml"
}
}
34 changes: 34 additions & 0 deletions truffle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Allows us to use ES6 in our migrations and tests.
require('babel-register');
require('dotenv').config();
let HDWalletProvider = require('truffle-hdwallet-provider');

module.exports = {
networks: {
development: {
host: process.env.ETHEREUM_NETWORK_HOST || 'ethereum',
port: '8545',
network_id: '*',
},
ropsten: {
provider: function() {
return new HDWalletProvider(
process.env.ROPSTEN_MNEMONIC,
`https://ropsten.infura.io/${process.env.INFURA_ACCESS_TOKEN}`,
0
);
},
gas: 4612388,
gasPrice: 1,
network_id: 3,
},
},
mocha: {
useColors: true,
reporter: 'mocha-multi-reporters',
reporterOptions: {
configFile: './mocha-smart-contracts-config.json',
},
},

};

0 comments on commit b73cc0e

Please sign in to comment.