This repository has been archived by the owner on Feb 17, 2020. It is now read-only.
forked from olegabu/fabric-starter-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
51 lines (34 loc) · 1.61 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const fs = require('fs');
const myorg = process.env.ORG || 'org1';
const DOMAIN = process.env.DOMAIN || 'example.com';
let cryptoConfigDir = process.env.CRYPTO_CONFIG_DIR || '../fabric-starter/crypto-config';
console.log(`Crypto-config path: ${cryptoConfigDir}`);
const enrollId = process.env.ENROLL_ID || 'admin';
const enrollSecret = process.env.ENROLL_SECRET || 'adminpw';
// default to peer0.org1.example.com:7051 inside docker-compose or export ORGS='{"org1":"peer0.org1.example.com:7051","org2":"peer0.org2.example.com:7051"}'
let orgs = process.env.ORGS || '"org1":"peer0.org1.example.com:7051"';
let cas = process.env.CAS || '"org1":"peer0.org1.example.com:7054"';
const ORDERER_CRYPTO_DIR = `${cryptoConfigDir}/ordererOrganizations/${DOMAIN}`;
const PEER_CRYPTO_DIR = `${cryptoConfigDir}/peerOrganizations/${myorg}.${DOMAIN}`;
const ordererName = 'orderer';
const ordererAddr = `orderer.${DOMAIN}:7050`;
const ordererApiPort = process.env.ORDERER_API_PORT ||'4500';
const ordererApiAddr = `api.${DOMAIN}:${ordererApiPort}`;
const systemChannelId = "orderer-system-channel";
module.exports = {
domain: DOMAIN,
org: myorg,
enrollId: enrollId,
enrollSecret: enrollSecret,
orgs: orgs,
cas: cas,
ordererName: ordererName,
ORDERER_CRYPTO_DIR: ORDERER_CRYPTO_DIR,
ORDERER_TLS_CERT: `${ORDERER_CRYPTO_DIR}/msp/tlscacerts/tlsca.${DOMAIN}-cert.pem`,
ORDERER_ADDR: ordererAddr,
ORDERER_API_ADDR: ordererApiAddr,
PEER_CRYPTO_DIR: PEER_CRYPTO_DIR,
systemChannelId: systemChannelId,
isOrderer: ordererName == myorg,
INVOKE_RETRY_COUNT: process.env.INVOKE_RETRY_COUNT || 10
};