Skip to content

Commit

Permalink
refactor(cmd-api-server): clean up configuration parameters #720
Browse files Browse the repository at this point in the history
fixes: #720

Parameters cleaned up are: cactusNodeId, consortiumId, keychainSuffixKeyPairPem
Parameter keyPairPem cannot be removed as it results to an error in running
the api server.

Cleaning the three mentioned parameters 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 <[email protected]>
  • Loading branch information
ruzell22 committed Apr 6, 2023
1 parent e251168 commit e763552
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -26,7 +24,6 @@
"cockpitTlsKeyPem": "-----BEGIN RSA PRIVATE KEY-----\r\nMIIJKAIBAAKCAgEAslebFV2ZuSf/EsfDIaAj3sm38CeyKsbIta5dXGsGwD0S38V4\r\nsVOQcs15V8RYerzDHPD+Iz1dkhIVO7E9TLPexrhHbi00Wgq+SwUcQzRd16wlkxWe\r\nK+c+LReEiy8e/N95gKUobtJX6c6F+M5BIOyZZuj+KVewwhRD9cFbCOrivCAzV7ZA\r\nN2naLEf/E3kuimPOBOa5IYxjKJ4C1wuMXaWGNJp9kSwbYFblqcpEyf0IhPYJpsCM\r\nGqwwMXmSWr5ME68YQKQ/2rvv8ud7OKVz8qSwJrFasndoUtlZ4az+fMRMtVBUwC1x\r\nq4SO7a5fiicklaZ2Z2+oIcGjR7mGTLWgPcpQtC8InnP45duF+B+Q+P0CuDtwuSa5\r\n/ZFeM4p8S2g01wiaAUwWWA6BueKCWhYc/P5N1ixxbCYo8habxif2/yD9G2bNS0Jl\r\nLuTxLo8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VQ4laeqvruD9BnAr69Ppt5UNRCAXDBNEhVWtSwkis+avK+XDlhapvt\r\no+Z8kMbJqHHTGAZLSUp4qaLGu8TlhA9Dyi7aQjN4WG8fzSlFup/TIivK6U6GE/rj\r\nVUnBic2qVWnOdLLZV4fo6xRzwwF22UJjVgb1l15nMR+lDpGvPznr5TMOR0lXCxFj\r\n0y8D4gkgNzclVqjKYwYbQEGgo5k01ycep0A+YRFB2DIlDLPFwcqU0ukZGm/XnC58\r\n9GJfpuKacnK5WDwzR2SoYPbOQxKrlnkCggEBANJLCqOibsezhhNa1vg+JpCL777C\r\nKAkE8bQd7rPoEZIFQqDDdapez0ZrzVWL4L8pgnpjyywxXe0p77PR5A2HRN5z1cFD\r\nDz5Kd0ZDL++5/IQ6KJgQ9EjftIy1zW+XnzBXThY+rpH0RZ15DwFoJxw+PCejjLC5\r\n7zYa2EOJ698N9WryGsxGkfPuViTbIDJKBed+4kXgLTT1hCTq53JFTJtHsO57gRkK\r\ngrPsa0O10EsJtKODFNFHzAiqwfmNxrVVcmUNmKYG4WXuJci+kw1VEJDD6GiSFyx2\r\n1MBhF3x64UtKdsj/7Cskdr6xnrxC9NHsRoZlmGGMZsSFL+MLovZv9MKl6W0=\r\n-----END RSA PRIVATE 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",
Expand Down
2 changes: 0 additions & 2 deletions examples/carbon-accounting/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions examples/supply-chain-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions examples/supply-chain-app/process.env
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions packages/cactus-cmd-api-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export interface ICactusApiServerOptions {
authorizationProtocol: AuthorizationProtocol;
authorizationConfigJson: IAuthorizationConfig;
configFile: string;
cactusNodeId: string;
consortiumId: string;
logLevel: LogLevelDesc;
tlsDefaultMaxVersion: SecureVersion;
cockpitEnabled: boolean;
Expand All @@ -66,7 +64,6 @@ export interface ICactusApiServerOptions {
grpcMtlsEnabled: boolean;
plugins: PluginImport[];
keyPairPem: string;
keychainSuffixKeyPairPem: string;
minNodeVersion: string;
enableShutdownHook: boolean;
}
Expand Down Expand Up @@ -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: " +
Expand Down Expand Up @@ -427,17 +406,7 @@ 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 " +
Expand Down Expand Up @@ -613,8 +582,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",
Expand All @@ -640,8 +607,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,
};
Expand Down
2 changes: 0 additions & 2 deletions tools/docker/besu-all-in-one/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 2 additions & 7 deletions whitepaper/whitepaper.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 5 additions & 10 deletions whitepaper/whitepaper_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-终端用户钱包身份验证授权)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e763552

Please sign in to comment.