Skip to content

Commit 57aa6c0

Browse files
committed
add log warning about using default creds file
1 parent 6b51cab commit 57aa6c0

File tree

4 files changed

+63
-42
lines changed

4 files changed

+63
-42
lines changed

app.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,24 @@ console.log('------------------------------------------ Server Up - ' + host + '
105105
if (process.env.PRODUCTION) logger.debug('Running using Production settings');
106106
else logger.debug('Running using Developer settings');
107107

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

109127
// ============================================================================================================================
110128
// Warning

config/blockchain_creds1.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
22
"credentials": {
3-
"network_id": "test",
4-
"network_name": "Marbles Tutorial",
3+
"network_id": "FakeNetworkId",
54
"orderers": [
65
{
7-
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7050",
6+
"discovery": "grpc://localhost:7050",
87
"msp_id": "Org1MSP"
98
}
109
],
1110
"cas": [
1211
{
13-
"api": "http://varadvm2.rtp.raleigh.ibm.com:7054",
12+
"api": "http://localhost:7054",
1413
"msp_id": "Org1MSP",
1514
"users": [
1615
{
@@ -23,16 +22,16 @@
2322
"peers": [
2423
{
2524
"name": "fabric-peer-1a",
26-
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7051",
27-
"events": "grpc://varadvm2.rtp.raleigh.ibm.com:7053",
25+
"discovery": "grpc://localhost:7051",
26+
"events": "grpc://localhost:7053",
2827
"msp_id": "Org1MSP"
2928
}
3029
],
3130
"app": {
3231
"channel_id": "mychannel",
3332
"chaincode_id": "marbles",
3433
"chaincode_version": "v0",
35-
"block_delay": 1000
34+
"block_delay": 1000
3635
}
3736
}
3837
}

config/blockchain_creds2.json

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
{
2-
"credentials": {
3-
"network_id": "test",
4-
"network_name": "Marbles Tutorial",
5-
"orderers": [
6-
{
7-
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7050",
8-
"msp_id": "Org1MSP"
9-
}
10-
],
11-
"cas": [
12-
{
13-
"api": "http://varadvm2.rtp.raleigh.ibm.com:7054",
14-
"msp_id": "Org1MSP",
15-
"users": [
16-
{
17-
"enrollId": "admin",
18-
"enrollSecret": "adminpw"
19-
}
20-
]
21-
}
22-
],
23-
"peers": [
24-
{
25-
"name": "fabric-peer-1a",
26-
"discovery": "grpc://varadvm2.rtp.raleigh.ibm.com:7051",
27-
"events": "grpc://varadvm2.rtp.raleigh.ibm.com:7053",
28-
"msp_id": "Org1MSP"
29-
}
30-
],
31-
"app": {
32-
"channel_id": "mychannel",
33-
"chaincode_id": "marbles",
34-
"chaincode_version": "v0",
2+
"credentials": {
3+
"network_id": "FakeNetworkId",
4+
"orderers": [
5+
{
6+
"discovery": "grpc://localhost:7050",
7+
"msp_id": "Org1MSP"
8+
}
9+
],
10+
"cas": [
11+
{
12+
"api": "http://localhost:8054",
13+
"msp_id": "Org1MSP",
14+
"users": [
15+
{
16+
"enrollId": "admin2",
17+
"enrollSecret": "adminpw2"
18+
}
19+
]
20+
}
21+
],
22+
"peers": [
23+
{
24+
"name": "fabric-peer-2a",
25+
"discovery": "grpc://localhost:8051",
26+
"events": "grpc://localhost:8053",
27+
"msp_id": "Org1MSP"
28+
}
29+
],
30+
"app": {
31+
"channel_id": "mychannel",
32+
"chaincode_id": "marbles",
33+
"chaincode_version": "v0",
3534
"block_delay": 1000
36-
}
37-
}
35+
}
36+
}
3837
}

utils/helper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ module.exports = function (config_filename, logger) {
3131
return helper.creds.credentials.network_id;
3232
};
3333

34+
// get cred file name
35+
helper.getNetworkCredFileName = function () {
36+
return helper.config.cred_filename;
37+
};
38+
3439
// get a peer's grpc url
3540
helper.getPeersUrl = function (index) {
3641
if (index === undefined || index == null) {

0 commit comments

Comments
 (0)