mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-20 08:35:09 +00:00
* Import Full Stack Asset Transfer Guide at commit fb554befdbbeff9e69159b54fce0b811603f29c7 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Update the workshop with a new WORKSHOP_PATH under fabric-samples Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Update the workshop with a new WORKSHOP_PATH under fabric-samples Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * missed a .git ignored directory on add Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Updates to run the workshop on the Apple M1 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Workaround for https://github.com/eslint/eslint/issues/15299 in the contract tslinter Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Build an arch-specific CC images on M1 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * empty commit - force a build Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * revert an accidental commit that was building the top-level asset-transfer as arm64 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
45 lines
1.9 KiB
TypeScript
45 lines
1.9 KiB
TypeScript
/*
|
|
* Copyright contributors to the Hyperledgendary Full Stack Asset Transfer Guide project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { resolve } from 'path';
|
|
import { assertDefined } from './utils';
|
|
|
|
export const GATEWAY_ENDPOINT = assertEnv('ENDPOINT');
|
|
export const MSP_ID = assertEnv('MSP_ID');
|
|
export const CLIENT_CERT_PATH = resolve(assertEnv('CERTIFICATE'));
|
|
export const PRIVATE_KEY_PATH = resolve(assertEnv('PRIVATE_KEY'));
|
|
export const TLS_CERT_PATH = resolvePathIfPresent(process.env.TLS_CERT);
|
|
export const CHANNEL_NAME = process.env.CHANNEL_NAME ?? 'mychannel';
|
|
export const CHAINCODE_NAME = process.env.CHAINCODE_NAME ?? 'asset-transfer';
|
|
|
|
// Gateway peer SSL host name override.
|
|
export const HOST_ALIAS = process.env.HOST_ALIAS;
|
|
|
|
function assertEnv(envName: string): string {
|
|
return assertDefined(process.env[envName], () => {
|
|
console.error('The following environment variables must be set:' +
|
|
'\n ENDPOINT - Endpoint address of the gateway service' +
|
|
'\n MSP_ID - User\'s organization Member Services Provider ID' +
|
|
'\n CERTIFICATE - User\'s certificate file' +
|
|
'\n PRIVATE_KEY - User\'s private key file' +
|
|
'\n' +
|
|
'\nThe following environment variables are optional:' +
|
|
'\n CHANNEL_NAME - Channel to which the chaincode is deployed' +
|
|
'\n CHAINCODE_NAME - Channel to which the chaincode is deployed' +
|
|
'\n TLS_CERT - TLS CA root certificate (only if using TLS and private CA)' +
|
|
'\n HOST_ALIAS - TLS hostname override (only if TLS cert does not match endpoint)' +
|
|
'\n');
|
|
return `Environment variable ${envName} not set`;
|
|
});
|
|
}
|
|
|
|
function resolvePathIfPresent(path: string | undefined): string | undefined {
|
|
if (path == undefined) {
|
|
return undefined;
|
|
}
|
|
|
|
return resolve(path);
|
|
}
|