Browse Source

Simplify truffle config

develop
Apostolos Fanakis 4 years ago
parent
commit
9f0a809023
  1. 42
      packages/concordia-contracts/README.md
  2. 15
      packages/concordia-contracts/truffle-config.js

42
packages/concordia-contracts/README.md

@ -14,51 +14,55 @@ yarn lint
``` ```
## Migrate contracts ## Migrate contracts
Define the host and port of the blockchain in use. Default host and port values of the blockchain are:
Default values are:
| host | port | | host | port |
|---|---| |---|---|
| 127.0.0.1 | 8545 | | 127.0.0.1 | 8545 |
Migrate (using the development network by default):
```shell script
yarn migrate
```
### Setting different host and port values
Define the host and port of the blockchain in use.
Linux: Linux:
```shell script ```shell script
export DEVELOP_CHAIN_HOST="127.0.0.1" export CHAIN_HOST="127.0.0.1"
export DEVELOP_CHAIN_PORT="7545" export CHAIN_PORT="7545"
``` ```
Windows: Windows:
```shell script ```shell script
SET DEVELOP_CHAIN_HOST="127.0.0.1" SET CHAIN_HOST="127.0.0.1"
SET DEVELOP_CHAIN_PORT="7545" SET CHAIN_PORT="7545"
``` ```
Migrate (using the development network here, change if necessary): Migrate using the `env` network :
```shell script ```shell script
yarn migrate --network develop yarn _migrate --network env
``` ```
**Notice the underscore `_` suffix in the script name. This is not a mistake.**
## Test contracts ## Test contracts
Define the host and port of the blockchain in use. Default host and port values of the blockchain are:
Default values are:
| host | port | | host | port |
|---|---| |---|---|
| 127.0.0.1 | 8546 | | 127.0.0.1 | 8546 |
Linux:
```shell script
TEST_CHAIN_HOST="127.0.0.1"
TEST_CHAIN_PORT="7545"
```
Windows: Test:
```shell script ```shell script
SET TEST_CHAIN_HOST="127.0.0.1" yarn test
SET TEST_CHAIN_PORT="7545"
``` ```
### Setting different host and port values
Define the host and port of the blockchain in use like above.
Test: Test:
```shell script ```shell script
yarn test yarn test --network env
``` ```

15
packages/concordia-contracts/truffle-config.js

@ -2,7 +2,7 @@ const path = require('path');
const defaults = require('./constants/config/defaults'); const defaults = require('./constants/config/defaults');
const { const {
DEVELOP_CHAIN_HOST, DEVELOP_CHAIN_PORT, TEST_CHAIN_HOST, TEST_CHAIN_PORT, CHAIN_HOST, CHAIN_PORT,
} = process.env; } = process.env;
module.exports = { module.exports = {
@ -16,13 +16,18 @@ module.exports = {
contracts_build_directory: path.join(__dirname, 'build/'), contracts_build_directory: path.join(__dirname, 'build/'),
networks: { networks: {
develop: { develop: {
host: DEVELOP_CHAIN_HOST || defaults.develop.chainHost, host: defaults.develop.chainHost,
port: DEVELOP_CHAIN_PORT || defaults.develop.chainPort, port: defaults.develop.chainPort,
network_id: '*', network_id: '*',
}, },
test: { test: {
host: TEST_CHAIN_HOST || defaults.test.chainHost, host: defaults.test.chainHost,
port: TEST_CHAIN_PORT || defaults.test.chainPort, port: defaults.test.chainPort,
network_id: '*',
},
env: {
host: CHAIN_HOST,
port: CHAIN_PORT,
network_id: '*', network_id: '*',
}, },
}, },

Loading…
Cancel
Save