From fcb52ad8b03a36f2d3c12fc6e43da9fc6b65967e Mon Sep 17 00:00:00 2001 From: ruzell22 Date: Thu, 26 May 2022 13:34:15 +0800 Subject: [PATCH] refactor(cmd-api-server): clean up configuration parameters #720 fixes: #720 Parameters that are cleaned up are: cactusNodeId, consortiumId, keychainSuffixKeyPairPem together with their corresponding environment: CACTUS_NODE_ID, CONSORTIUM_ID, KEYCHAIN_SUFFIX_KEY_PAIR_PEM Parameter keyPairPem cannot be remove as it results to an error in running the api server. Cleaning the three mentioned parameter are backwards compatible with tags versions: v1.0.0-rc.3 and v1.0.0 The latest tag being used as of this change is v1.0.0-25-gdda3f00c Signed-off-by: ruzell22 --- .../example-config.json | 3 -- examples/carbon-accounting/Dockerfile | 2 -- examples/supply-chain-app/Dockerfile | 2 -- examples/supply-chain-app/process.env | 2 -- packages/cactus-cmd-api-server/Dockerfile | 2 -- .../main/typescript/config/config-service.ts | 36 ------------------- .../docker/besu-all-in-one/docker-compose.yml | 2 -- whitepaper/whitepaper.md | 9 ++--- whitepaper/whitepaper_zh-CN.md | 15 +++----- 9 files changed, 7 insertions(+), 66 deletions(-) diff --git a/examples/cactus-example-carbon-accounting-backend/example-config.json b/examples/cactus-example-carbon-accounting-backend/example-config.json index bf88de16e5b..0a017116572 100644 --- a/examples/cactus-example-carbon-accounting-backend/example-config.json +++ b/examples/cactus-example-carbon-accounting-backend/example-config.json @@ -1,8 +1,6 @@ { "configFile": ".config.json", "authorizationConfigJson" : {}, - "cactusNodeId": "972b1aec-a027-4dfb-bf0f-3811ad8d15e4", - "consortiumId": "fb3edae7-46db-4e84-837e-c66f6f2bc78e", "logLevel": "debug", "minNodeVersion": "12.0.0", "tlsDefaultMaxVersion": "TLSv1.3", @@ -26,7 +24,6 @@ "cockpitTlsKeyPem": "-----BEGIN RSA PRIVATE KEY-----\r\nMIIJKAIBAAKCAgEAslebFV2ZuSf/EsfDIaAj3sm38CeyKsbIta5dXGsGwD0S38V4\r\nsVOQcs15V8RYerzDHPD+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KEY-----\r\n", "cockpitTlsClientCaPem": "-", "keyPairPem": "-----BEGIN PRIVATE KEY-----\nMIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgHy0hDxj3Uhz16F8aLiWq\nhf6bcqRU3fqAv2u2YvYdSF+hRANCAAQpvM3dbCigeGLDKs0JUTi0yf5UHGC2eSRD\nd3Dk1WpBjbJDLKGdSGVGE0h1Zys8o3Den3Xag8Y1EcTxDHDInMEc\n-----END PRIVATE KEY-----\n", - "keychainSuffixKeyPairPem": "CACTUS_NODE_KEY_PAIR_PEM", "plugins": [ { "packageName": "@hyperledger/cactus-plugin-keychain-memory", diff --git a/examples/carbon-accounting/Dockerfile b/examples/carbon-accounting/Dockerfile index e0ada229d02..2358ffa5916 100644 --- a/examples/carbon-accounting/Dockerfile +++ b/examples/carbon-accounting/Dockerfile @@ -46,8 +46,6 @@ COPY --chown=${APP_USER}:${APP_USER} ./examples/carbon-accounting/healthcheck.sh ENV AUTHORIZATION_CONFIG_JSON="{}" ENV AUTHORIZATION_PROTOCOL=NONE -ENV CACTUS_NODE_ID=- -ENV CONSORTIUM_ID=- ENV KEY_PAIR_PEM=- ENV COCKPIT_WWW_ROOT=/usr/src/app/node_modules/@hyperledger/cactus-example-carbon-accounting-frontend/www/ ENV COCKPIT_TLS_ENABLED=false diff --git a/examples/supply-chain-app/Dockerfile b/examples/supply-chain-app/Dockerfile index 9b7cba8ac78..57fcd26644c 100644 --- a/examples/supply-chain-app/Dockerfile +++ b/examples/supply-chain-app/Dockerfile @@ -47,8 +47,6 @@ COPY --chown=${APP_USER}:${APP_USER} ./examples/supply-chain-app/healthcheck.sh ENV AUTHORIZATION_CONFIG_JSON="{}" ENV AUTHORIZATION_PROTOCOL=NONE -ENV CACTUS_NODE_ID=- -ENV CONSORTIUM_ID=- ENV KEY_PAIR_PEM=- ENV COCKPIT_WWW_ROOT=/usr/src/app/node_modules/@hyperledger/cactus-example-supply-chain-frontend/www/ ENV COCKPIT_TLS_ENABLED=false diff --git a/examples/supply-chain-app/process.env b/examples/supply-chain-app/process.env index 23c2f0c1ee8..472e4b645a7 100644 --- a/examples/supply-chain-app/process.env +++ b/examples/supply-chain-app/process.env @@ -1,5 +1,3 @@ -CACTUS_NODE_ID=- -CONSORTIUM_ID=- KEY_PAIR_PEM=- COCKPIT_WWW_ROOT=./node_modules/@hyperledger/cactus-example-supply-chain-frontend/www/ COCKPIT_TLS_ENABLED=false diff --git a/packages/cactus-cmd-api-server/Dockerfile b/packages/cactus-cmd-api-server/Dockerfile index bcf3ece5ead..c122b846e64 100644 --- a/packages/cactus-cmd-api-server/Dockerfile +++ b/packages/cactus-cmd-api-server/Dockerfile @@ -27,8 +27,6 @@ ARG NPM_PKG_VERSION=latest ENV TZ=Etc/UTC ENV NODE_ENV=production -ENV CACTUS_NODE_ID=- -ENV CONSORTIUM_ID=- ENV KEY_PAIR_PEM=- ENV COCKPIT_WWW_ROOT=${APP}node_modules/@hyperledger/cactus-cockpit/www/ ENV COCKPIT_TLS_ENABLED=false diff --git a/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts b/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts index c6cc1b14986..03ffe843c9c 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/config/config-service.ts @@ -39,8 +39,6 @@ export interface ICactusApiServerOptions { authorizationProtocol: AuthorizationProtocol; authorizationConfigJson: IAuthorizationConfig; configFile: string; - cactusNodeId: string; - consortiumId: string; logLevel: LogLevelDesc; tlsDefaultMaxVersion: SecureVersion; cockpitEnabled: boolean; @@ -66,7 +64,6 @@ export interface ICactusApiServerOptions { grpcMtlsEnabled: boolean; plugins: PluginImport[]; keyPairPem: string; - keychainSuffixKeyPairPem: string; minNodeVersion: string; enableShutdownHook: boolean; } @@ -180,24 +177,6 @@ export class ConfigService { env: "CONFIG_FILE", arg: "config-file", }, - consortiumId: { - doc: - "Identifier of the consortium your node is part of. " + - " Can be any string of characters such as a UUID", - format: ConfigService.formatNonBlankString, - default: null as string | null, - env: "CONSORTIUM_ID", - arg: "consortium-id", - }, - cactusNodeId: { - doc: - "Identifier of this particular Cactus node. Must be unique among the total set of Cactus nodes running in any " + - "given Cactus deployment. Can be any string of characters such as a UUID or an Int64", - format: ConfigService.formatNonBlankString, - default: null as string | null, - env: "CACTUS_NODE_ID", - arg: "cactus-node-id", - }, logLevel: { doc: "The level at which loggers should be configured. Supported values include the following: " + @@ -427,17 +406,6 @@ export class ConfigService { format: ConfigService.formatNonBlankString, default: null as string | null, }, - keychainSuffixKeyPairPem: { - doc: - "The key under which to store/retrieve the key pair PEM from the " + - " keychain of this Cactus node (API server) The complete lookup key" + - " is constructed from the ${CACTUS_NODE_ID}" + - "${KEYCHAIN_SUFFIX_KEY_PAIR_PEM} template.", - env: "KEYCHAIN_SUFFIX_KEY_PAIR_PEM", - arg: "keychain-suffix-key-pair-pem", - format: "*", - default: "CACTUS_NODE_KEY_PAIR_PEM", - }, enableShutdownHook: { doc: "It will cause the API server to listen to OS process signals and will attempt " + @@ -613,8 +581,6 @@ export class ConfigService { authorizationProtocol: AuthorizationProtocol.JSON_WEB_TOKEN, authorizationConfigJson, configFile: ".config.json", - cactusNodeId: uuidV4(), - consortiumId: uuidV4(), logLevel: "debug", minNodeVersion: (schema.minNodeVersion as SchemaObj).default, tlsDefaultMaxVersion: "TLSv1.3", @@ -640,8 +606,6 @@ export class ConfigService { cockpitTlsKeyPem: pkiServer.privateKeyPem, cockpitTlsClientCaPem: "-", // Cockpit mTLS is off so this will not crash the server keyPairPem, - keychainSuffixKeyPairPem: (schema.keychainSuffixKeyPairPem as SchemaObj) - .default, plugins, enableShutdownHook, }; diff --git a/tools/docker/besu-all-in-one/docker-compose.yml b/tools/docker/besu-all-in-one/docker-compose.yml index e42d5a46bc0..d088901c7b3 100644 --- a/tools/docker/besu-all-in-one/docker-compose.yml +++ b/tools/docker/besu-all-in-one/docker-compose.yml @@ -17,8 +17,6 @@ services: cactus-api-server: image: ghcr.io/hyperledger/cactus-cmd-api-server:2021-08-15--refactor-1222 environment: - CACTUS_NODE_ID: "-" - CONSORTIUM_ID: "-" KEY_PAIR_PEM: "-" COCKPIT_WWW_ROOT: ${APP}node_modules/@hyperledger/cactus-cockpit/www/ COCKPIT_TLS_ENABLED: "false" diff --git a/whitepaper/whitepaper.md b/whitepaper/whitepaper.md index a1bceec920c..fbbe2d8f6d0 100644 --- a/whitepaper/whitepaper.md +++ b/whitepaper/whitepaper.md @@ -1077,11 +1077,6 @@ Configuration Parameters Default: Mandatory parameter without a default value. Env: CONFIG_FILE CLI: --config-file - cactusNodeId: - Description: Identifier of this particular Cactus node. Must be unique among the total set of Cactus nodes running in any given Cactus deployment. Can be any string of characters such as a UUID or an Int64 - Default: Mandatory parameter without a default value. - Env: CACTUS_NODE_ID - CLI: --cactus-node-id logLevel: Description: The level at which loggers should be configured. Supported values include the following: error, warn, info, debug, trace Default: warn @@ -1128,12 +1123,12 @@ Configuration Parameters Env: PRIVATE_KEY CLI: --private-key keychainSuffixPrivateKey: - Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. + Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. Default: CACTUS_NODE_PRIVATE_KEY Env: KEYCHAIN_SUFFIX_PRIVATE_KEY CLI: --keychain-suffix-private-key keychainSuffixPublicKey: - Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. + Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. Default: CACTUS_NODE_PUBLIC_KEY Env: KEYCHAIN_SUFFIX_PUBLIC_KEY CLI: --keychain-suffix-public-key diff --git a/whitepaper/whitepaper_zh-CN.md b/whitepaper/whitepaper_zh-CN.md index 30ed742fbb5..06479fef189 100644 --- a/whitepaper/whitepaper_zh-CN.md +++ b/whitepaper/whitepaper_zh-CN.md @@ -46,8 +46,8 @@ Photo by Pontus Wellgraf on Unsplash - [2.2 数据托管出售](#22-数据托管出售) - [2.3 货币兑换](#23-货币兑换) - [2.4 稳定币和其他货币的铆定](#24-稳定币和其他货币的铆定) - - [2.4.1 和非授权区块链(BTC)](#241-和非授权区块链btc) - - [2.4.2 和法定货币](#242-和法定货币) + - [2.4.1 和非授权区块链兑换](#241-和非授权区块链兑换) + - [2.4.2 和法定货币兑换](#242-和法定货币兑换) - [2.5 带有访问控制列表的医疗保健数据共享](#25-带有访问控制列表的医疗保健数据共享) - [2.6 集成现有的食品溯源解决方案](#26-集成现有的食品溯源解决方案) - [2.7 终端用户钱包身份验证/授权](#27-终端用户钱包身份验证授权) @@ -81,7 +81,7 @@ Photo by Pontus Wellgraf on Unsplash - [4.3 技术架构](#43-技术架构) - [4.3.1 Monorepo包](#431-monorepo包) - [4.3.1.1 cmd-api-server](#4311-cmd-api-server) - - [4.3.1.1.1 运行时配置解析和验证](#43111-运行时配置解析和验证) + - [4.3.1.1.1 运行时配置解析和验证](#43111--运行时配置解析和验证) - [4.3.1.1.2 配置模式 - API 服务器](#43112-配置模式---api-服务器) - [4.3.1.1.4 插件加载/验证](#43114-插件加载验证) - [4.3.1.2 core-api](#4312-core-api) @@ -511,11 +511,6 @@ $ npx ts-node -e "import {ConfigService} from './packages/cactus-cmd-api-server/ Default: Mandatory parameter without a default value. Env: CONFIG_FILE CLI: --config-file - cactusNodeId: - Description: Identifier of this particular Cactus node. Must be unique among the total set of Cactus nodes running in any given Cactus deployment. Can be any string of characters such as a UUID or an Int64 - Default: Mandatory parameter without a default value. - Env: CACTUS_NODE_ID - CLI: --cactus-node-id logLevel: Description: The level at which loggers should be configured. Supported values include the following: error, warn, info, debug, trace Default: warn @@ -562,12 +557,12 @@ $ npx ts-node -e "import {ConfigService} from './packages/cactus-cmd-api-server/ Env: PRIVATE_KEY CLI: --private-key keychainSuffixPrivateKey: - Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. + Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. Default: CACTUS_NODE_PRIVATE_KEY Env: KEYCHAIN_SUFFIX_PRIVATE_KEY CLI: --keychain-suffix-private-key keychainSuffixPublicKey: - Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. + Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template. Default: CACTUS_NODE_PUBLIC_KEY Env: KEYCHAIN_SUFFIX_PUBLIC_KEY CLI: --keychain-suffix-public-key