mirror of https://github.com/embarklabs/embark.git
Update “no account” message and hide for infura
The “no account” message was appearing when using infura as the contract deploy target. This has been changed so that this message will only show when the user has configured their environment to have a `networkType` of `testnet`, `rinkeby`, or `mainnet` and a missing `account` address and/or password. Additionally, the warning message has been updated to help the user resolve the issue. A flag has also been added to prevent the message from appearing multiple times.
This commit is contained in:
parent
58a75f5080
commit
743c4fa8cb
|
@ -24,6 +24,7 @@ var Config = function(options) {
|
|||
this.events = options.events;
|
||||
this.embarkConfig = {};
|
||||
this.context = options.context || [constants.contexts.any];
|
||||
this.shownNoAccountConfigMsg = false; // flag to ensure "no account config" message is only displayed once to the user
|
||||
|
||||
self.events.setCommandHandler("config:contractsConfig", (cb) => {
|
||||
cb(self.contractsConfig);
|
||||
|
@ -183,13 +184,30 @@ Config.prototype.loadBlockchainConfigFile = function() {
|
|||
if (!configFilePath) {
|
||||
this.blockchainConfig.default = true;
|
||||
}
|
||||
if (!this.blockchainConfig.account && !this.blockchainConfig.isDev &&
|
||||
if (
|
||||
!this.shownNoAccountConfigMsg &&
|
||||
(/rinkeby|testnet|livenet/).test(this.blockchainConfig.networkType) &&
|
||||
!(this.blockchainConfig.account && this.blockchainConfig.account.address && this.blockchainConfig.account.password) &&
|
||||
!this.blockchainConfig.isDev &&
|
||||
this.env !== 'development' && this.env !== 'test') {
|
||||
this.logger.warn(
|
||||
__('Account settings are needed for this chain.' +
|
||||
' Please put a valid address and possibly a password in your blockchain config or use a dev chain.')
|
||||
);
|
||||
}
|
||||
this.logger.warn((
|
||||
'\n=== ' + __('Cannot unlock account - account config missing').bold + ' ===\n' +
|
||||
__('Geth is configured to sync to a testnet/livenet and needs to unlock an account ' +
|
||||
'to allow your dApp to interact with geth, however, the address and password must ' +
|
||||
'be specified in your blockchain config. Please update your blockchain config with ' +
|
||||
'a valid address and password: \n') +
|
||||
` - config/blockchain.js > ${this.env} > account\n\n`.italic +
|
||||
__('Please also make sure the keystore file for the account is located at: ') +
|
||||
'\n - Mac: ' + `~/Library/Ethereum/${this.env}/keystore`.italic +
|
||||
'\n - Linux: ' + `~/.ethereum/${this.env}/keystore`.italic +
|
||||
'\n - Windows: ' + `%APPDATA%\Ethereum/${this.env}/keystore`.italic) +
|
||||
__('\n\nAlternatively, you could change ' +
|
||||
`config/blockchain.js > ${this.env} > networkType`.italic +
|
||||
__(' to ') +
|
||||
'"custom"\n'.italic).yellow
|
||||
);
|
||||
this.shownNoAccountConfigMsg = true;
|
||||
}
|
||||
};
|
||||
|
||||
Config.prototype.loadContractsConfigFile = function() {
|
||||
|
|
Loading…
Reference in New Issue