From: Jérôme Benoit Date: Thu, 9 Dec 2021 14:28:52 +0000 (+0100) Subject: Fix default configuration handling on some sections X-Git-Tag: v1.1.40~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1ba1e8fb644aa0ba8c0295c9eedb6f63e5467459;p=e-mobility-charging-stations-simulator.git Fix default configuration handling on some sections Signed-off-by: Jérôme Benoit --- diff --git a/package-lock.json b/package-lock.json index e5975774..2d31f4ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,14 +37,14 @@ "@types/tar": "^6.1.1", "@types/uuid": "^8.3.3", "@types/ws": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.5.0", - "@typescript-eslint/parser": "^5.5.0", + "@typescript-eslint/eslint-plugin": "^5.6.0", + "@typescript-eslint/parser": "^5.6.0", "auto-changelog": "^2.3.0", "clinic": "^10.0.0", "cross-env": "^7.0.3", "eslint": "^8.4.1", "eslint-plugin-import": "^2.25.3", - "eslint-plugin-jsdoc": "^37.1.0", + "eslint-plugin-jsdoc": "^37.2.0", "eslint-plugin-node": "^11.1.0", "expect": "^27.4.2", "mocha": "^9.1.3", @@ -53,7 +53,7 @@ "nyc": "^15.1.0", "release-it": "^14.11.8", "robohydra": "^0.6.9", - "rollup": "^2.60.2", + "rollup": "^2.61.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", @@ -698,12 +698,12 @@ } }, "node_modules/@es-joy/jsdoccomment": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.12.0.tgz", - "integrity": "sha512-Gw4/j9v36IKY8ET+W0GoOzrRw17xjf21EIFFRL3zx21fF5MnqmeNpNi+PU/LKjqLpPb2Pw2XdlJbYM31VVo/PQ==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.13.0.tgz", + "integrity": "sha512-APVqbVPGOprb4BmjEnwbSzV+V2e/6DVIUnZG3zdW5uWXWkN0DKMCpiIy2TdBauoANKYO7RQpO8cTjIYNVSKwUA==", "dev": true, "dependencies": { - "comment-parser": "1.2.4", + "comment-parser": "1.3.0", "esquery": "^1.4.0", "jsdoc-type-pratt-parser": "2.0.0" }, @@ -711,15 +711,6 @@ "node": "^12 || ^14 || ^16 || ^17" } }, - "node_modules/@es-joy/jsdoccomment/node_modules/comment-parser": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.2.4.tgz", - "integrity": "sha512-pm0b+qv+CkWNriSTMsfnjChF9kH0kxz55y44Wo5le9qLxMj5xDQAaEd9ZN1ovSuk9CsrncWaFwgpOMg7ClJwkw==", - "dev": true, - "engines": { - "node": ">= 12.0.0" - } - }, "node_modules/@eslint/eslintrc": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", @@ -1608,9 +1599,9 @@ } }, "node_modules/@types/lodash": { - "version": "4.14.177", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.177.tgz", - "integrity": "sha512-0fDwydE2clKe9MNfvXHBHF9WEahRuj+msTuQqOmAApNORFvhMYZKNGGJdCzuhheVjMps/ti0Ak/iJPACMaevvw==", + "version": "4.14.178", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz", + "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==", "devOptional": true }, "node_modules/@types/minimatch": { @@ -3601,9 +3592,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001285", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001285.tgz", - "integrity": "sha512-KAOkuUtcQ901MtmvxfKD+ODHH9YVDYnBt+TGYSz2KIfnq22CiArbUxXPN9067gNbgMlnNYRSwho8OPXZPALB9Q==", + "version": "1.0.30001286", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001286.tgz", + "integrity": "sha512-zaEMRH6xg8ESMi2eQ3R4eZ5qw/hJiVsO/HlLwniIwErij0JDr9P+8V4dtx1l+kLq6j3yy8l8W4fst1lBnat5wQ==", "dev": true, "funding": { "type": "opencollective", @@ -5468,9 +5459,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.13", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.13.tgz", - "integrity": "sha512-ih5tIhzEuf78pBY70FXLo+Pw73R5MPPPcXb4CGBMJaCQt/qo/IGIesKXmswpemVCKSE2Bulr5FslUv7gAWJoOw==", + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.14.tgz", + "integrity": "sha512-RsGkAN9JEAYMObS72kzUsPPcPGMqX1rBqGuXi9aa4TBKLzICoLf+DAAtd0fVFzrniJqYzpby47gthCUoObfs0Q==", "dev": true }, "node_modules/elliptic": { @@ -6045,12 +6036,12 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "37.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.1.0.tgz", - "integrity": "sha512-DpkFzX5Sqkqzy4MCgowhDXmusWcF1Gn7wYnphdGfWmIkoQr6SwL0jEtltGAVyF5Rj6ACi6ydw0oCCI5hF3yz6w==", + "version": "37.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.2.0.tgz", + "integrity": "sha512-ca7s/DD1mMObZQ2Y0n0DO/KnFV+FqCX6ztir8pcSuylg3GGCREIisn36P/0cRySuWW/7Y7MNCuUDqtKdgLPU7Q==", "dev": true, "dependencies": { - "@es-joy/jsdoccomment": "0.12.0", + "@es-joy/jsdoccomment": "0.13.0", "comment-parser": "1.3.0", "debug": "^4.3.3", "escape-string-regexp": "^4.0.0", @@ -15571,9 +15562,9 @@ } }, "node_modules/rollup": { - "version": "2.60.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.60.2.tgz", - "integrity": "sha512-1Bgjpq61sPjgoZzuiDSGvbI1tD91giZABgjCQBKM5aYLnzjq52GoDuWVwT/cm/MCxCMPU8gqQvkj8doQ5C8Oqw==", + "version": "2.61.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.61.0.tgz", + "integrity": "sha512-teQ+T1mUYbyvGyUavCodiyA9hD4DxwYZJwr/qehZGhs1Z49vsmzelMVYMxGU4ZhGRKxYPupHuz5yzm/wj7VpWA==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -19802,22 +19793,14 @@ } }, "@es-joy/jsdoccomment": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.12.0.tgz", - "integrity": "sha512-Gw4/j9v36IKY8ET+W0GoOzrRw17xjf21EIFFRL3zx21fF5MnqmeNpNi+PU/LKjqLpPb2Pw2XdlJbYM31VVo/PQ==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.13.0.tgz", + "integrity": "sha512-APVqbVPGOprb4BmjEnwbSzV+V2e/6DVIUnZG3zdW5uWXWkN0DKMCpiIy2TdBauoANKYO7RQpO8cTjIYNVSKwUA==", "dev": true, "requires": { - "comment-parser": "1.2.4", + "comment-parser": "1.3.0", "esquery": "^1.4.0", "jsdoc-type-pratt-parser": "2.0.0" - }, - "dependencies": { - "comment-parser": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.2.4.tgz", - "integrity": "sha512-pm0b+qv+CkWNriSTMsfnjChF9kH0kxz55y44Wo5le9qLxMj5xDQAaEd9ZN1ovSuk9CsrncWaFwgpOMg7ClJwkw==", - "dev": true - } } }, "@eslint/eslintrc": { @@ -20474,9 +20457,9 @@ } }, "@types/lodash": { - "version": "4.14.177", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.177.tgz", - "integrity": "sha512-0fDwydE2clKe9MNfvXHBHF9WEahRuj+msTuQqOmAApNORFvhMYZKNGGJdCzuhheVjMps/ti0Ak/iJPACMaevvw==", + "version": "4.14.178", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz", + "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==", "devOptional": true }, "@types/minimatch": { @@ -22079,9 +22062,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001285", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001285.tgz", - "integrity": "sha512-KAOkuUtcQ901MtmvxfKD+ODHH9YVDYnBt+TGYSz2KIfnq22CiArbUxXPN9067gNbgMlnNYRSwho8OPXZPALB9Q==", + "version": "1.0.30001286", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001286.tgz", + "integrity": "sha512-zaEMRH6xg8ESMi2eQ3R4eZ5qw/hJiVsO/HlLwniIwErij0JDr9P+8V4dtx1l+kLq6j3yy8l8W4fst1lBnat5wQ==", "dev": true }, "capture-stack-trace": { @@ -23622,9 +23605,9 @@ } }, "electron-to-chromium": { - "version": "1.4.13", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.13.tgz", - "integrity": "sha512-ih5tIhzEuf78pBY70FXLo+Pw73R5MPPPcXb4CGBMJaCQt/qo/IGIesKXmswpemVCKSE2Bulr5FslUv7gAWJoOw==", + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.14.tgz", + "integrity": "sha512-RsGkAN9JEAYMObS72kzUsPPcPGMqX1rBqGuXi9aa4TBKLzICoLf+DAAtd0fVFzrniJqYzpby47gthCUoObfs0Q==", "dev": true }, "elliptic": { @@ -24144,12 +24127,12 @@ } }, "eslint-plugin-jsdoc": { - "version": "37.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.1.0.tgz", - "integrity": "sha512-DpkFzX5Sqkqzy4MCgowhDXmusWcF1Gn7wYnphdGfWmIkoQr6SwL0jEtltGAVyF5Rj6ACi6ydw0oCCI5hF3yz6w==", + "version": "37.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.2.0.tgz", + "integrity": "sha512-ca7s/DD1mMObZQ2Y0n0DO/KnFV+FqCX6ztir8pcSuylg3GGCREIisn36P/0cRySuWW/7Y7MNCuUDqtKdgLPU7Q==", "dev": true, "requires": { - "@es-joy/jsdoccomment": "0.12.0", + "@es-joy/jsdoccomment": "0.13.0", "comment-parser": "1.3.0", "debug": "^4.3.3", "escape-string-regexp": "^4.0.0", @@ -31601,9 +31584,9 @@ } }, "rollup": { - "version": "2.60.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.60.2.tgz", - "integrity": "sha512-1Bgjpq61sPjgoZzuiDSGvbI1tD91giZABgjCQBKM5aYLnzjq52GoDuWVwT/cm/MCxCMPU8gqQvkj8doQ5C8Oqw==", + "version": "2.61.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.61.0.tgz", + "integrity": "sha512-teQ+T1mUYbyvGyUavCodiyA9hD4DxwYZJwr/qehZGhs1Z49vsmzelMVYMxGU4ZhGRKxYPupHuz5yzm/wj7VpWA==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/package.json b/package.json index cd95341b..a06b58ff 100644 --- a/package.json +++ b/package.json @@ -99,14 +99,14 @@ "@types/tar": "^6.1.1", "@types/uuid": "^8.3.3", "@types/ws": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.5.0", - "@typescript-eslint/parser": "^5.5.0", + "@typescript-eslint/eslint-plugin": "^5.6.0", + "@typescript-eslint/parser": "^5.6.0", "auto-changelog": "^2.3.0", "clinic": "^10.0.0", "cross-env": "^7.0.3", "eslint": "^8.4.1", "eslint-plugin-import": "^2.25.3", - "eslint-plugin-jsdoc": "^37.1.0", + "eslint-plugin-jsdoc": "^37.2.0", "eslint-plugin-node": "^11.1.0", "expect": "^27.4.2", "mocha": "^9.1.3", @@ -115,7 +115,7 @@ "nyc": "^15.1.0", "release-it": "^14.11.8", "robohydra": "^0.6.9", - "rollup": "^2.60.2", + "rollup": "^2.61.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 8311d5d8..8e3675b1 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -37,12 +37,14 @@ export default class Configuration { if (Configuration.objectHasOwnProperty(Configuration.getConfig(), 'uiWebSocketServer')) { if (Configuration.objectHasOwnProperty(Configuration.getConfig().uiWebSocketServer, 'options')) { options = { + ...options, ...Configuration.objectHasOwnProperty(Configuration.getConfig().uiWebSocketServer.options, 'host') && { host: Configuration.getConfig().uiWebSocketServer.options.host }, ...Configuration.objectHasOwnProperty(Configuration.getConfig().uiWebSocketServer.options, 'port') && { port: Configuration.getConfig().uiWebSocketServer.options.port } }; } uiWebSocketServerConfiguration = { + ...uiWebSocketServerConfiguration, ...Configuration.objectHasOwnProperty(Configuration.getConfig().uiWebSocketServer, 'enabled') && { enabled: Configuration.getConfig().uiWebSocketServer.enabled }, options }; @@ -60,15 +62,10 @@ export default class Configuration { if (Configuration.objectHasOwnProperty(Configuration.getConfig(), 'performanceStorage')) { storageConfiguration = { - ...Configuration.objectHasOwnProperty(Configuration.getConfig().performanceStorage, 'enabled') - ? { enabled: Configuration.getConfig().performanceStorage.enabled } - : { enabled: false }, - ...Configuration.objectHasOwnProperty(Configuration.getConfig().performanceStorage, 'type') - ? { type: Configuration.getConfig().performanceStorage.type } - : { type: StorageType.JSON_FILE }, - ...Configuration.objectHasOwnProperty(Configuration.getConfig().performanceStorage, 'uri') - ? { uri: Configuration.getConfig().performanceStorage.uri } - : { uri: this.getDefaultPerformanceStorageUri(Configuration.getConfig()?.performanceStorage?.type ?? StorageType.JSON_FILE) } + ...storageConfiguration, + ...Configuration.objectHasOwnProperty(Configuration.getConfig().performanceStorage, 'enabled') && { enabled: Configuration.getConfig().performanceStorage.enabled }, + ...Configuration.objectHasOwnProperty(Configuration.getConfig().performanceStorage, 'type') && { type: Configuration.getConfig().performanceStorage.type }, + ...Configuration.objectHasOwnProperty(Configuration.getConfig().performanceStorage, 'uri') && { uri: this.getDefaultPerformanceStorageUri(Configuration.getConfig()?.performanceStorage?.type ?? StorageType.JSON_FILE) } }; } return storageConfiguration;