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
Define the host and port of the blockchain in use.
Default values are:
Default host and port values of the blockchain are:
| host | port |
|---|---|
| 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:
```shell script
export DEVELOP_CHAIN_HOST="127.0.0.1"
export DEVELOP_CHAIN_PORT="7545"
export CHAIN_HOST="127.0.0.1"
export CHAIN_PORT="7545"
```
Windows:
```shell script
SET DEVELOP_CHAIN_HOST="127.0.0.1"
SET DEVELOP_CHAIN_PORT="7545"
SET CHAIN_HOST="127.0.0.1"
SET CHAIN_PORT="7545"
```
Migrate (using the development network here, change if necessary):
Migrate using the `env` network :
```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
Define the host and port of the blockchain in use.
Default values are:
Default host and port values of the blockchain are:
| host | port |
|---|---|
| 127.0.0.1 | 8546 |
Linux:
```shell script
TEST_CHAIN_HOST="127.0.0.1"
TEST_CHAIN_PORT="7545"
```
Windows:
Test:
```shell script
SET TEST_CHAIN_HOST="127.0.0.1"
SET TEST_CHAIN_PORT="7545"
yarn test
```
### Setting different host and port values
Define the host and port of the blockchain in use like above.
Test:
```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 {
DEVELOP_CHAIN_HOST, DEVELOP_CHAIN_PORT, TEST_CHAIN_HOST, TEST_CHAIN_PORT,
CHAIN_HOST, CHAIN_PORT,
} = process.env;
module.exports = {
@ -16,13 +16,18 @@ module.exports = {
contracts_build_directory: path.join(__dirname, 'build/'),
networks: {
develop: {
host: DEVELOP_CHAIN_HOST || defaults.develop.chainHost,
port: DEVELOP_CHAIN_PORT || defaults.develop.chainPort,
host: defaults.develop.chainHost,
port: defaults.develop.chainPort,
network_id: '*',
},
test: {
host: TEST_CHAIN_HOST || defaults.test.chainHost,
port: TEST_CHAIN_PORT || defaults.test.chainPort,
host: defaults.test.chainHost,
port: defaults.test.chainPort,
network_id: '*',
},
env: {
host: CHAIN_HOST,
port: CHAIN_PORT,
network_id: '*',
},
},

Loading…
Cancel
Save