Signpost configuration details

Signed-off-by: James Taylor <jamest@uk.ibm.com>
This commit is contained in:
James Taylor 2021-12-06 10:56:43 +00:00
parent 5a32d803c9
commit b0256a57b5
5 changed files with 47 additions and 47 deletions

View file

@ -1,39 +1,23 @@
LOG_LEVEL=info
# Sample .env file
#
# These are the minimum configuration variables required to start the sample
#
# See src/config.ts for details and for all the available configuration
# variables
#
PORT=3000
HLF_CONNECTION_PROFILE_ORG1=
RETRY_DELAY=3000
HLF_CERTIFICATE_ORG1=
MAX_RETRY_COUNT=5
HLF_PRIVATE_KEY_ORG1=
AS_LOCAL_HOST=true
HLF_CONNECTION_PROFILE_ORG2=
HLF_CONNECTION_PROFILE_ORG1={"name":"test-network-org1","version":"1.0.0","client":{"organization":"Org1" ... }
HLF_CERTIFICATE_ORG2=
HLF_CERTIFICATE_ORG1="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n"
HLF_PRIVATE_KEY_ORG2=
HLF_PRIVATE_KEY_ORG1="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
ORG1_APIKEY=
HLF_CONNECTION_PROFILE_ORG2={"name":"test-network-org2","version":"1.0.0","client":{"organization":"Org2" ... }
HLF_CERTIFICATE_ORG2="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n"
HLF_PRIVATE_KEY_ORG2="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
HLF_COMMIT_TIMEOUT=3000
HLF_ENDORSE_TIMEOUT=30
HLF_QUERY_TIMEOUT=3
REDIS_HOST=localhost
REDIS_PORT=6379
#REDIS_USERNAME=
#REDIS_PASSWORD=
ORG1_APIKEY=D2F66BFF-D68B-458D-8FA6-285F172D5B03
ORG2_APIKEY=92042C1F-8E58-48F9-9EAF-91A98A2B764
ORG2_APIKEY=

View file

@ -23,6 +23,8 @@ Alternatively you might prefer to modify the sample to only retry transactions w
- CHAINCODE_VERSION_CONFLICT
- EXPIRED_CHAINCODE
See [src/index.ts](src/index.ts) for a description of the sample code structure, and [src/config.ts](src/config.ts) for details of configuring the sample using environment variables.
## Usage
**Note:** these instructions should work with the main branch of `fabric-samples`

View file

@ -17,14 +17,14 @@ ${AS_LOCAL_HOST:=true}
cat << ENV_END > .env
# Generated .env file
# See src/config.ts for details of all the available configuration variables
#
LOG_LEVEL=info
PORT=3000
RETRY_DELAY=3000
MAX_RETRY_COUNT=5
HLF_CERTIFICATE_ORG1="$(cat ${CERTIFICATE_FILE_ORG1} | sed -e 's/$/\\n/' | tr -d '\r\n')"
HLF_PRIVATE_KEY_ORG1="$(cat ${PRIVATE_KEY_FILE_ORG1} | sed -e 's/$/\\n/' | tr -d '\r\n')"
@ -33,12 +33,6 @@ HLF_CERTIFICATE_ORG2="$(cat ${CERTIFICATE_FILE_ORG2} | sed -e 's/$/\\n/' | tr -d
HLF_PRIVATE_KEY_ORG2="$(cat ${PRIVATE_KEY_FILE_ORG2} | sed -e 's/$/\\n/' | tr -d '\r\n')"
HLF_COMMIT_TIMEOUT=3000
HLF_ENDORSE_TIMEOUT=30
HLF_QUERY_TIMEOUT=3
REDIS_PORT=6379
ORG1_APIKEY=$(uuidgen)

View file

@ -1,5 +1,16 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The sample REST server can be configured using the environment variables
* documented below
*
* In a local development environment, these variables can be loaded from a
* .env file by starting the server with the following command:
*
* npm start:dev
*
* The scripts/generateEnv.sh script can be used to generate a suitable .env
* file for the Fabric Test Network
*/
import * as env from 'env-var';
@ -142,8 +153,8 @@ export const chaincodeName = env
*/
export const commitTimeout = env
.get('HLF_COMMIT_TIMEOUT')
.default('3000')
.example('3000')
.default('300')
.example('300')
.asIntPositive();
/*
@ -176,7 +187,7 @@ export const connectionProfileOrg1 = env
.asJsonObject() as Record<string, unknown>;
/*
* Certificate for the Org1 identity
* Certificate for an Org1 identity to evaluate and submit transactions
*/
export const certificateOrg1 = env
.get('HLF_CERTIFICATE_ORG1')
@ -185,7 +196,7 @@ export const certificateOrg1 = env
.asString();
/*
* Private key for the Org1 identity
* Private key for an Org1 identity to evaluate and submit transactions
*/
export const privateKeyOrg1 = env
.get('HLF_PRIVATE_KEY_ORG1')
@ -205,7 +216,7 @@ export const connectionProfileOrg2 = env
.asJsonObject() as Record<string, unknown>;
/*
* Certificate for the Org2 identity
* Certificate for an Org2 identity to evaluate and submit transactions
*/
export const certificateOrg2 = env
.get('HLF_CERTIFICATE_ORG2')
@ -214,7 +225,7 @@ export const certificateOrg2 = env
.asString();
/*
* Private key for the Org2 identity
* Private key for an Org2 identity to evaluate and submit transactions
*/
export const privateKeyOrg2 = env
.get('HLF_PRIVATE_KEY_ORG2')

View file

@ -1,5 +1,14 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* This is the main entrypoint for the sample REST server, which is responsible
* for connecting to the Fabric network and setting up a job queue for
* processing submit transactions
*
* You can find details of other aspects of the sample in the following files:
*
* - config.ts
* descriptions of all the available configuration environment variables
*/
import { Contract } from 'fabric-network';