mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-10 22:16:20 +00:00
fix defaults when contracts config file is not present
This commit is contained in:
parent
e093ff5b30
commit
747237de76
@ -75,19 +75,24 @@ Config.prototype.loadBlockchainConfigFile = function() {
|
||||
Config.prototype.loadContractsConfigFile = function() {
|
||||
|
||||
var configObject = {
|
||||
"versions": {
|
||||
"web3.js": "0.19.1",
|
||||
"solc": "0.4.17"
|
||||
},
|
||||
"deployment": {
|
||||
"host": "localhost",
|
||||
"port": 8545,
|
||||
"type": "rpc"
|
||||
},
|
||||
"dappConnection": [
|
||||
"$WEB3",
|
||||
"localhost:8545"
|
||||
]
|
||||
"default": {
|
||||
"versions": {
|
||||
"web3.js": "1.0.0-beta",
|
||||
"solc": "0.4.17"
|
||||
},
|
||||
"deployment": {
|
||||
"host": "localhost",
|
||||
"port": 8545,
|
||||
"type": "rpc"
|
||||
},
|
||||
"dappConnection": [
|
||||
"$WEB3",
|
||||
"localhost:8545"
|
||||
],
|
||||
"gas": "auto",
|
||||
"contracts": {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var configPlugins = this.plugins.getPluginsFor('contractsConfig');
|
||||
@ -99,8 +104,11 @@ Config.prototype.loadContractsConfigFile = function() {
|
||||
});
|
||||
}
|
||||
|
||||
var contractsConfig = fs.readJSONSync(this.configDir + "contracts.json");
|
||||
configObject = utils.recursiveMerge(configObject, contractsConfig);
|
||||
var contractsConfig;
|
||||
if (fs.existsSync(this.configDir + "contracts.json")) {
|
||||
contractsConfig = fs.readJSONSync(this.configDir + "contracts.json");
|
||||
configObject = utils.recursiveMerge(configObject, contractsConfig);
|
||||
}
|
||||
var defaultContractsConfig = configObject['default'];
|
||||
var envContractsConfig = configObject[this.env];
|
||||
|
||||
|
@ -36,6 +36,9 @@ describe('embark.Config', function() {
|
||||
it('should load contract config correctly', function() {
|
||||
config.loadContractsConfigFile();
|
||||
let expectedConfig = {
|
||||
versions: { 'web3.js': '1.0.0-beta', solc: '0.4.17' },
|
||||
deployment: { host: 'localhost', port: 8545, type: 'rpc' },
|
||||
dappConnection: [ '$WEB3', 'localhost:8545' ],
|
||||
"gas": "auto",
|
||||
"contracts": {
|
||||
"SimpleStorage": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user