Skip to content
Snippets Groups Projects
Commit 1573e9cc authored by Javier Diaz's avatar Javier Diaz
Browse files

Code Cleanup

parent c45dd3fe
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!259Resolve "(CTTC) Replace DLT Gateway functionality with an opensource and Hyper Ledger v2.4+ compliant version"
......@@ -22,7 +22,6 @@ data:
MSP_ID: "Org1MSP" #Change according to your blockchain configuration
PEER_ENDPOINT: "10.1.1.96:7051" #Change to required peer address according to your blockchain deployment#
PEER_HOST_ALIAS: "peer0.org1.adrenaline.com" #Change according to your blockchain configuration
CRYPTO_PATH: "/test-network/organizations/peerOrganizations/org1.adrenaline.com"
KEY_DIRECTORY_PATH: "/etc/hyperledger/fabric-keystore/keystore"
CERT_DIRECTORY_PATH: "/etc/hyperledger/fabric-signcerts/signcerts.pem"
TLS_CERT_PATH: "/etc/hyperledger/fabric-ca-crt/ca.crt"
......@@ -92,37 +91,10 @@ spec:
- name: ca-crt
mountPath: /etc/hyperledger/fabric-ca-crt
readOnly: true
envFrom:
- configMapRef:
name: dlt-config
env:
- name: CHANNEL_NAME
valueFrom:
configMapKeyRef:
name: dlt-config
key: CHANNEL_NAME
- name: CHAINCODE_NAME
valueFrom:
configMapKeyRef:
name: dlt-config
key: CHAINCODE_NAME
- name: MSP_ID
valueFrom:
configMapKeyRef:
name: dlt-config
key: MSP_ID
- name: PEER_ENDPOINT
valueFrom:
configMapKeyRef:
name: dlt-config
key: PEER_ENDPOINT
- name: PEER_HOST_ALIAS
valueFrom:
configMapKeyRef:
name: dlt-config
key: PEER_HOST_ALIAS
- name: CRYPTO_PATH
valueFrom:
configMapKeyRef:
name: dlt-config
key: CRYPTO_PATH
- name: KEY_DIRECTORY_PATH
value: "/etc/hyperledger/fabric-keystore/keystore"
- name: CERT_DIRECTORY_PATH
......
......@@ -25,8 +25,6 @@ const channelName = getEnvVar('CHANNEL_NAME');
const chaincodeName = getEnvVar('CHAINCODE_NAME');
const mspId = getEnvVar('MSP_ID');
// Path to crypto materials.
const cryptoPath = getEnvVar('CRYPTO_PATH');
// Path to user private key directory.
const keyDirectoryPath = getEnvVar('KEY_DIRECTORY_PATH');
......@@ -114,21 +112,15 @@ async function newGrpcConnection(): Promise<grpc.Client> {
async function newIdentity(): Promise<Identity> {
//const certPath = await getFirstDirFileName(certDirectoryPath);
console.log("DEBUG", certDirectoryPath);
//console.log("DEBUG", certDirectoryPath);
const credentials = await fs.readFile(certDirectoryPath);
return { mspId, credentials };
}
//async function getFirstDirFileName(dirPath: string): Promise<string> {
// const files = await fs.readdir(dirPath);
// const filePath = path.join(dirPath, files[0]);
// const realFilePath = await fs.readlink(filePath);
// return path.join(dirPath, realFilePath);
//}
async function newSigner(): Promise<Signer> {
//const keyPath = await getFirstDirFileName(keyDirectoryPath);
console.log("DEBUG2", keyDirectoryPath);
//console.log("DEBUG2", keyDirectoryPath);
const privateKeyPem = await fs.readFile(keyDirectoryPath);
const privateKey = crypto.createPrivateKey(privateKeyPem);
return signers.newPrivateKeySigner(privateKey);
......@@ -171,7 +163,6 @@ async function displayInputParameters(): Promise<void> {
console.log(`channelName: ${channelName}`);
console.log(`chaincodeName: ${chaincodeName}`);
console.log(`mspId: ${mspId}`);
console.log(`cryptoPath: ${cryptoPath}`);
console.log(`keyDirectoryPath: ${keyDirectoryPath}`);
console.log(`certDirectoryPath: ${certDirectoryPath}`);
console.log(`tlsCertPath: ${tlsCertPath}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment