From 39915c1f1fe42d8df4badf24a4688a3e1c64bd2f Mon Sep 17 00:00:00 2001 From: Piotr Hejwowski Date: Fri, 13 Oct 2023 14:55:07 +0200 Subject: [PATCH] started connection-profile stuff Signed-off-by: hejwo Signed-off-by: Piotr Hejwowski --- src/extend-config/extendGlobal.ts | 3 ++- src/types/ConnectionProfile.ts | 6 ++++-- src/types/FabloConfigExtended.ts | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 9c2517f8..ded3df3c 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -61,10 +61,11 @@ const extendGlobal = (globalJson: GlobalJson): Global => { }; return { + engine, ...globalJson, ...getVersions(globalJson.fabricVersion), - engine, paths: getPathsFromEnv(), + serviceDiscoveryOn: !globalJson.peerDevMode, monitoring, capabilities: getNetworkCapabilities(globalJson.fabricVersion), tools: { ...explorer }, diff --git a/src/types/ConnectionProfile.ts b/src/types/ConnectionProfile.ts index fb4dc911..a327d9d6 100644 --- a/src/types/ConnectionProfile.ts +++ b/src/types/ConnectionProfile.ts @@ -109,6 +109,7 @@ function createPeers( orgName: string, isExplorer: boolean, isTls: boolean, + isServiceDiscoveryOn: boolean, rootPath: string, orgs: OrgConfig[], ): { [key: string]: Peer } { @@ -187,9 +188,10 @@ function createChannels(org: OrgConfig, channels: ChannelConfig[]): { [name: str return cs; } +//todo hejwo ===> continure here export function createConnectionProfile(global: Global, org: OrgConfig, orgs: OrgConfig[]): ConnectionProfile { const rootPath = `${global.paths.chaincodesBaseDir}/fablo-target/fabric-config/crypto-config`; - const peers = createPeers(org.name, false, global.tls, rootPath, orgs); + const peers = createPeers(org.name, false, global.tls, global.serviceDiscoveryOn, rootPath, orgs); return { name: `fablo-test-network-${org.name.toLowerCase()}`, description: `Connection profile for ${org.name} in Fablo network`, @@ -215,7 +217,7 @@ export function createExplorerConnectionProfile( orgs: OrgConfig[], ): ExplorerConnectionProfile { const rootPath = "/tmp/crypto"; - const peers = createPeers(p.org.name, true, global.tls, rootPath, orgs); + const peers = createPeers(p.org.name, true, global.tls, global.serviceDiscoveryOn, rootPath, orgs); return { name: `fablo-test-network-${p.org.name.toLowerCase()}`, description: `Connection profile for Hyperledger Explorer in Fablo network`, diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index f912c689..5ced61ab 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -26,6 +26,8 @@ export type Capabilities = CapabilitiesV1 | CapabilitiesV2; export interface Global extends FabricVersions { tls: boolean; + peerDevMode: boolean; + serviceDiscoveryOn: boolean; engine: "kubernetes" | "docker"; monitoring: { loglevel: string }; paths: { fabloConfig: string; chaincodesBaseDir: string };