diff --git a/lib/cmd.js b/lib/cmd.js index 2399d2e1..a0c33099 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -105,10 +105,6 @@ class Cmd { _options.logLevel = _options.loglevel; // fix casing _options.onlyCompile = _options.contracts; _options.client = _options.client || 'geth'; - embark.initConfig(env || 'development', { - embarkConfig: 'embark.json', - interceptLogs: false - }); embark.build(_options); }); } @@ -128,10 +124,6 @@ class Cmd { .description(__('run dapp (default: %s)', 'development')) .action(function (env, options) { i18n.setOrDetectLocale(options.locale); - embark.initConfig(env || 'development', { - embarkConfig: 'embark.json', - interceptLogs: false - }); embark.run({ env: env || 'development', serverPort: options.port, @@ -221,10 +213,6 @@ class Cmd { _options.logFile = _options.logfile; // fix casing _options.logLevel = _options.loglevel; // fix casing _options.client = _options.client || 'geth'; - embark.initConfig(env || 'development', { - embarkConfig: 'embark.json', - interceptLogs: false - }); embark.upload(_options); }); } @@ -239,10 +227,6 @@ class Cmd { .description(__('generates documentation based on the smart contracts configured')) .action(function (env, options) { i18n.setOrDetectLocale(options.locale); - embark.initConfig(env || 'development', { - embarkConfig: 'embark.json', - interceptLogs: false - }); embark.graph({ env: env || 'development', logFile: options.logfile, diff --git a/lib/cmds/blockchain/blockchain.js b/lib/cmds/blockchain/blockchain.js index 50e7ac49..bc51f2c4 100644 --- a/lib/cmds/blockchain/blockchain.js +++ b/lib/cmds/blockchain/blockchain.js @@ -301,7 +301,8 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) { }); }; -var BlockchainClient = function(blockchainConfig, client, env, isDev, onReadyCallback, onExitCallback) { +var BlockchainClient = function(blockchainConfig, client, env, onReadyCallback, onExitCallback) { + const isDev = blockchainConfig.isDev || blockchainConfig.default; // TODO add other clients at some point if (client === 'geth') { return new Blockchain({blockchainConfig, client: GethCommands, env, isDev, onReadyCallback, onExitCallback}); diff --git a/lib/cmds/blockchain/blockchainProcess.js b/lib/cmds/blockchain/blockchainProcess.js index 01317421..abd879d4 100644 --- a/lib/cmds/blockchain/blockchainProcess.js +++ b/lib/cmds/blockchain/blockchainProcess.js @@ -20,7 +20,6 @@ class BlockchainProcess extends ProcessWrapper { this.blockchainConfig, this.client, this.env, - this.isDev, this.blockchainReady.bind(this), this.blockchainExit.bind(this) ); diff --git a/lib/core/engine.js b/lib/core/engine.js index b95f58f9..86c970e3 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -6,7 +6,6 @@ const IPC = require('./ipc'); class Engine { constructor(options) { this.env = options.env; - this.isDev = options.isDev; this.client = options.client; this.locale = options.locale; this.embarkConfig = options.embarkConfig; @@ -30,6 +29,7 @@ class Engine { this.config = new Config({env: this.env, logger: this.logger, events: this.events, context: this.context}); this.config.loadConfigFiles({embarkConfig: this.embarkConfig, interceptLogs: this.interceptLogs}); this.plugins = this.config.plugins; + this.isDev = this.config && this.config.blockchainConfig && (this.config.blockchainConfig.isDev || this.config.blockchainConfig.default); if (this.interceptLogs || this.interceptLogs === undefined) { this.doInterceptLogs(); diff --git a/lib/index.js b/lib/index.js index b1e291d3..f0f80d4d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -30,10 +30,6 @@ class Embark { this.plugins = this.config.plugins; } - isDev() { - return this.config && this.config.blockchainConfig && (this.config.blockchainConfig.isDev || this.config.blockchainConfig.default); - } - blockchain(env, client) { this.context = [constants.contexts.blockchain]; return require('./cmds/blockchain/blockchain.js')(this.config.blockchainConfig, client, env, this.isDev(env), () => {}).run(); @@ -70,7 +66,6 @@ class Embark { env: options.env, client: options.client, locale: options.locale, - isDev: this.isDev(), version: this.version, embarkConfig: options.embarkConfig || 'embark.json', logFile: options.logFile, @@ -165,7 +160,6 @@ class Embark { env: options.env, client: options.client, locale: options.locale, - isDev: this.isDev(), version: this.version, embarkConfig: 'embark.json', interceptLogs: false, @@ -235,7 +229,6 @@ class Embark { const Engine = require('./core/engine.js'); const engine = new Engine({ env: options.env, - isDev: this.isDev(), version: this.version, embarkConfig: options.embarkConfig || 'embark.json', logFile: options.logFile, @@ -290,7 +283,6 @@ class Embark { env: options.env, client: options.client, locale: options.locale, - isDev: this.isDev(), version: this.version, embarkConfig: 'embark.json', interceptLogs: false,