Skip to content

Commit

Permalink
add log warning about using default creds file
Browse files Browse the repository at this point in the history
  • Loading branch information
dshuffma-ibm committed Mar 28, 2017
1 parent 6b51cab commit 57aa6c0
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 42 deletions.
18 changes: 18 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,24 @@ console.log('------------------------------------------ Server Up - ' + host + '
if (process.env.PRODUCTION) logger.debug('Running using Production settings');
else logger.debug('Running using Developer settings');

if(helper.getNetworkId() === 'FakeNetworkId') {
console.log('\n\n');
logger.warn('----------------------------------------------------------------------');
logger.warn('----------------------------- Hey Buddy! -----------------------------');
logger.warn('------------------------ It looks like you did -----------------------');
logger.error('------------------------------- not --------------------------------');
logger.warn('------------------------- follow my instructions ---------------------');
logger.warn('----------------------------------------------------------------------');
logger.warn('Your network config JSON has a network ID of "FakeNetworkID"...');
logger.warn('You likely have other settings that are wrong too!');
logger.warn('----------------------------------------------------------------------');
logger.error('Fix this file: ' + helper.getNetworkCredFileName());
logger.warn('It must have credentials/hostnames/ports/channels/etc for YOUR network');
logger.warn('How/where would I get that info? Using the Bluemix service? Then look at these instructions(near the end): ');
logger.warn(' https://github.com/IBM-Blockchain/marbles/blob/v3.0/docs/install_chaincode.md');
logger.warn('----------------------------------------------------------------------');
console.log('\n\n');
}

// ============================================================================================================================
// Warning
Expand Down
13 changes: 6 additions & 7 deletions config/blockchain_creds1.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"credentials": {
"network_id": "test",
"network_name": "Marbles Tutorial",
"network_id": "FakeNetworkId",
"orderers": [
{
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7050",
"discovery": "grpc://localhost:7050",
"msp_id": "Org1MSP"
}
],
"cas": [
{
"api": "http://varadvm2.rtp.raleigh.ibm.com:7054",
"api": "http://localhost:7054",
"msp_id": "Org1MSP",
"users": [
{
Expand All @@ -23,16 +22,16 @@
"peers": [
{
"name": "fabric-peer-1a",
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7051",
"events": "grpc://varadvm2.rtp.raleigh.ibm.com:7053",
"discovery": "grpc://localhost:7051",
"events": "grpc://localhost:7053",
"msp_id": "Org1MSP"
}
],
"app": {
"channel_id": "mychannel",
"chaincode_id": "marbles",
"chaincode_version": "v0",
"block_delay": 1000
"block_delay": 1000
}
}
}
69 changes: 34 additions & 35 deletions config/blockchain_creds2.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
{
"credentials": {
"network_id": "test",
"network_name": "Marbles Tutorial",
"orderers": [
{
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7050",
"msp_id": "Org1MSP"
}
],
"cas": [
{
"api": "http://varadvm2.rtp.raleigh.ibm.com:7054",
"msp_id": "Org1MSP",
"users": [
{
"enrollId": "admin",
"enrollSecret": "adminpw"
}
]
}
],
"peers": [
{
"name": "fabric-peer-1a",
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7051",
"events": "grpc://varadvm2.rtp.raleigh.ibm.com:7053",
"msp_id": "Org1MSP"
}
],
"app": {
"channel_id": "mychannel",
"chaincode_id": "marbles",
"chaincode_version": "v0",
"credentials": {
"network_id": "FakeNetworkId",
"orderers": [
{
"discovery": "grpc://localhost:7050",
"msp_id": "Org1MSP"
}
],
"cas": [
{
"api": "http://localhost:8054",
"msp_id": "Org1MSP",
"users": [
{
"enrollId": "admin2",
"enrollSecret": "adminpw2"
}
]
}
],
"peers": [
{
"name": "fabric-peer-2a",
"discovery": "grpc://localhost:8051",
"events": "grpc://localhost:8053",
"msp_id": "Org1MSP"
}
],
"app": {
"channel_id": "mychannel",
"chaincode_id": "marbles",
"chaincode_version": "v0",
"block_delay": 1000
}
}
}
}
}
5 changes: 5 additions & 0 deletions utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ module.exports = function (config_filename, logger) {
return helper.creds.credentials.network_id;
};

// get cred file name
helper.getNetworkCredFileName = function () {
return helper.config.cred_filename;
};

// get a peer's grpc url
helper.getPeersUrl = function (index) {
if (index === undefined || index == null) {
Expand Down

0 comments on commit 57aa6c0

Please sign in to comment.