Merge pull request #78 from gerbrand/develop

Allowing to define chains file per environment/chain
This commit is contained in:
Iuri Matias 2015-09-05 06:48:49 -04:00
commit 7c4f3ef1d9
4 changed files with 9 additions and 7 deletions

View File

@ -255,6 +255,7 @@ The environment is a specific blockchain configuration that can be managed at co
rpc_port: 8101 rpc_port: 8101
rpc_whitelist: "*" rpc_whitelist: "*"
datadir: default datadir: default
chains: chains_staging.json
network_id: 0 network_id: 0
console: true console: true
account: account:
@ -323,4 +324,3 @@ $ echo 'export PATH="$PATH:$HOME/npm-global/bin"' >>~/.bashrc
$ source ~/.bashrc $ source ~/.bashrc
$ npm install -g embark-framework grunt-cli $ npm install -g embark-framework grunt-cli
``` ```

View File

@ -17,15 +17,12 @@ var run = function(cmd) {
var deploy = function(env, embarkConfig) { var deploy = function(env, embarkConfig) {
var contractFiles = grunt.file.expand(embarkConfig.contracts); var contractFiles = grunt.file.expand(embarkConfig.contracts);
var destFile = embarkConfig.output; var destFile = embarkConfig.output;
var chainFile = embarkConfig.chains;
Embark.init(); Embark.init();
Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig); Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig);
Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig); Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig);
if (chainFile === undefined) { var chainFile = Embark.blockchainConfig.blockchainConfig[env].chains || embarkConfig.chains || './chains.json';
chainFile = './chains.json';
}
abi = Embark.deployContracts(env, contractFiles, destFile, chainFile); abi = Embark.deployContracts(env, contractFiles, destFile, chainFile);
grunt.file.write(destFile, abi); grunt.file.write(destFile, abi);

View File

@ -40,6 +40,7 @@ BlockchainConfig.prototype.config = function(env) {
minerthreads: config.minerthreads, minerthreads: config.minerthreads,
genesisBlock: config.genesis_block, genesisBlock: config.genesis_block,
datadir: config.datadir, datadir: config.datadir,
chains: config.chains,
networkId: networkId, networkId: networkId,
maxPeers: 4, maxPeers: 4,
port: config.port || "30303", port: config.port || "30303",

View File

@ -43,6 +43,7 @@ describe('embark.config.blockchain', function() {
minerthreads: 1, minerthreads: 1,
genesis_block: 'config/genesis.json', genesis_block: 'config/genesis.json',
datadir: '/tmp/embark', datadir: '/tmp/embark',
chains: 'chains_development.json',
mine_when_needed: true, mine_when_needed: true,
gas_limit: 123, gas_limit: 123,
gas_price: 100, gas_price: 100,
@ -67,6 +68,7 @@ describe('embark.config.blockchain', function() {
minerthreads: 1, minerthreads: 1,
genesisBlock: 'config/genesis.json', genesisBlock: 'config/genesis.json',
datadir: '/tmp/embark', datadir: '/tmp/embark',
chains: 'chains_development.json',
networkId: 0, networkId: 0,
maxPeers: 4, maxPeers: 4,
port: "30303", port: "30303",
@ -88,12 +90,13 @@ describe('embark.config.blockchain', function() {
network_id: 0, network_id: 0,
minerthreads: 1, minerthreads: 1,
datadir: '/tmp/embark', datadir: '/tmp/embark',
chains: undefined,
mine_when_needed: true, mine_when_needed: true,
console: false, console: false,
account: { account: {
init: true, init: true,
password: 'config/password' password: 'config/password'
} },
}, },
staging: {} staging: {}
}; };
@ -110,6 +113,7 @@ describe('embark.config.blockchain', function() {
minerthreads: 1, minerthreads: 1,
genesisBlock: undefined, genesisBlock: undefined,
datadir: '/tmp/embark', datadir: '/tmp/embark',
chains: undefined,
networkId: 0, networkId: 0,
maxPeers: 4, maxPeers: 4,
port: "30303", port: "30303",