Allowing to define chains file per environment/chain

This commit is contained in:
Gerbrand van DIeijen 2015-09-04 10:55:19 +02:00
parent d468e43f6f
commit 98054a2cbb
3 changed files with 7 additions and 5 deletions

View File

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

View File

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

View File

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