From cf3abfd878ed302c845fc230faaf96d9d1e5edd5 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Wed, 21 Nov 2018 13:24:18 +0000 Subject: [PATCH] FABN-1026: Add discovery 'asLocalhost' prop to TS defs Change-Id: I6388e16f42427a051dd8cf939151136cb44f6649 Signed-off-by: Mark S. Lewis --- fabric-client/lib/Channel.js | 2 +- fabric-network/lib/gateway.js | 3 +++ fabric-network/types/index.d.ts | 1 + test/typescript/integration/network-e2e/invoke.ts | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fabric-client/lib/Channel.js b/fabric-client/lib/Channel.js index 8b251e7e2a..7bdda48ab8 100755 --- a/fabric-client/lib/Channel.js +++ b/fabric-client/lib/Channel.js @@ -164,7 +164,7 @@ const Channel = class { * commit handler implementing {@link CommitHandler}. * @property {boolean} asLocalhost - Optional. Convert discovered host addresses * to be 'localhost'. Will be needed when running a docker composed - * fabric network on the local system. + * fabric network on the local system; otherwise should be disabled. Defaults to true. * @property {byte[]} configUpdate - Optional. To initialize this channel with * a serialized ConfigUpdate protobuf object. */ diff --git a/fabric-network/lib/gateway.js b/fabric-network/lib/gateway.js index 2f14d7362b..8b6564bfe7 100644 --- a/fabric-network/lib/gateway.js +++ b/fabric-network/lib/gateway.js @@ -58,7 +58,10 @@ const logger = require('./logger').getLogger('Gateway'); * @typedef {Object} Gateway~DiscoveryOptions * @memberof module:fabric-network * @property {boolean} [enabled=true] True if discovery should be used; otherwise false. + * @property {boolean} [asLocalhost=true] Convert discovered host addresses to be 'localhost'. Will be needed when + * running a docker composed fabric network on the local system; otherwise should be disabled. */ + /** * The gateway peer provides the connection point for an application to access the Fabric network. It is instantiated using * the default constructor. diff --git a/fabric-network/types/index.d.ts b/fabric-network/types/index.d.ts index a53ab60bda..cabc5e8dff 100644 --- a/fabric-network/types/index.d.ts +++ b/fabric-network/types/index.d.ts @@ -22,6 +22,7 @@ export interface GatewayOptions { } export interface DiscoveryOptions { + asLocalhost?: boolean; enabled?: boolean; } diff --git a/test/typescript/integration/network-e2e/invoke.ts b/test/typescript/integration/network-e2e/invoke.ts index f0d4f0da20..0782b1a30a 100644 --- a/test/typescript/integration/network-e2e/invoke.ts +++ b/test/typescript/integration/network-e2e/invoke.ts @@ -151,6 +151,7 @@ test('\n\n***** Network End-to-end flow: invoke multiple transactions to move mo const contract = await createContract(t, gateway, { clientTlsIdentity: 'tlsId', discovery: { + asLocalhost: true, // Redundant since discovery is disabled but ensures TS definitions are correct enabled: false, }, identity: 'User1@org1.example.com',