Make the build app self contained.
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 13 Feb 2021 17:35:03 +0000 (18:35 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 13 Feb 2021 17:35:03 +0000 (18:35 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
23 files changed:
.cfignore
.vscode/launch.json
.vscode/tasks.json [new file with mode: 0644]
Gruntfile.js
docker/Dockerfile
docker/autoconfig.sh
package-lock.json
package.json
src/assets/config-template.json
src/assets/configs-aws
src/assets/station-templates/abb-atg.station-template.json
src/assets/station-templates/abb.station-template.json
src/assets/station-templates/evlink.station-template.json
src/assets/station-templates/keba.station-template.json
src/assets/station-templates/schneider-imredd.station-template.json
src/assets/station-templates/schneider.station-template.json
src/assets/station-templates/siemens.station-template.json
src/assets/station-templates/virtual-simple-atg.station-template.json
src/assets/station-templates/virtual-simple.station-template.json
src/assets/station-templates/virtual.station-template.json
src/charging-station/Bootstrap.ts
src/charging-station/ChargingStation.ts
src/utils/Configuration.ts

index b4688e92d0b38caafec88f8f4163ee21d2bdd7d6..878b6bc3d7ad11f895b4f9ecab016b606551923e 100644 (file)
--- a/.cfignore
+++ b/.cfignore
@@ -2,6 +2,7 @@
 .gitignore
 .gitattributes
 .gitmodules
+.github
 .jshintrc
 .eslintrc
 .vscode
@@ -9,6 +10,8 @@
 .tscache
 # Logs
 *.log
+# Winston
+*-audit.json
 # Vim
 # Persistent undo
 [._]*.un~
 .netrwhist
 *~
 *.orig
+src
 ev-simulator-start.sh
 ev-simulator-start.bat
 README.md
 node_modules
 manifest-cf-template.yml
+mta.yaml
index 046c824677525fab70737a385d5ceb1535523374..8c879c6e4f77d876ccfbf85511fcdd93db9dbf85 100644 (file)
@@ -9,10 +9,11 @@
       "request": "launch",
       "name": "Debug Program via npm",
       "cwd": "${workspaceFolder}",
+      "preLaunchTask": "Build",
       "runtimeExecutable": "npm",
       "runtimeArgs": [
         "run-script",
-        "start:dev:debug"
+        "start:debug"
       ],
       "skipFiles": [
         "<node_internals>/**"
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644 (file)
index 0000000..343bcdc
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "version": "2.0.0",
+  "tasks": [
+    {
+      "label": "Build",
+      "type": "npm",
+      "script": "build"
+    }
+  ]
+}
index cc434c1706ed31bac8384dc0f1232419bf975d09..eeaeb558884a885df61876c18864d9e0371759f0 100644 (file)
@@ -3,12 +3,35 @@ module.exports = function(grunt) {
     pkg: grunt.file.readJSON('package.json'),
     ts: {
       tsconfig: './tsconfig.json',
-      dev: {
-        watch: './src'
+      buildWatch: {
+        watch: './src',
       },
       prod: {}
+    },
+    mkdir: {
+      assets: {
+        options: {
+          create: ['dist/assets'],
+        }
+      }
+    },
+    copy: {
+      assets: {
+        files: [{
+          expand: true,
+          cwd: 'src/assets',
+          src: '**',
+          dest: 'dist/assets',
+        }]
+      },
+    },
+    clean: {
+      build: ['dist'],
     }
   });
+  grunt.loadNpmTasks('grunt-contrib-clean');
+  grunt.loadNpmTasks('grunt-mkdir');
+  grunt.loadNpmTasks('grunt-contrib-copy');
   grunt.loadNpmTasks('grunt-ts');
-  grunt.registerTask('default', ['ts:prod']);
+  grunt.registerTask('default', ['clean:build', 'ts:prod', 'mkdir:assets', 'copy:assets']);
 };
index f881284818f77d46030e277c614a6f5dbd23e30f..059ced11053c172deedef5430450202df8fa6dc8 100644 (file)
@@ -14,10 +14,9 @@ WORKDIR /usr/app
 
 COPY --from=builder /usr/builder/node_modules ./node_modules
 COPY NOTICE LICENSE ./
-COPY src ./src
 COPY dist ./dist
 COPY *.json ./
-COPY docker/config.json ./src/assets/config.json
+COPY docker/config.json ./dist/assets/config.json
 COPY docker/autoconfig.sh /autoconfig.sh
 RUN chmod +x /autoconfig.sh
 
index b39dd3f00199eb4e830301a625df71ce0c61fadc..4d18821962bbee51077fe95297ba7b06c81f7429 100644 (file)
@@ -7,7 +7,7 @@ then
   [ -z $emobility_server_type ] && { echo "emobility env server type variable not found, exiting"; exit 1; }
   [ -z $emobility_service_type ] && { echo "emobility env service type variable not found, exiting"; exit 1; }
 
-  cp $emobility_install_dir/src/assets/configs-aws/$emobility_server_type-$emobility_service_type-$emobility_landscape.json $emobility_install_dir/src/assets/config.json
+  cp $emobility_install_dir/src/assets/configs-aws/$emobility_server_type-$emobility_service_type-$emobility_landscape.json $emobility_install_dir/dist/assets/config.json
 else
   echo "no emobility env defined, start with default configuration"
 fi
index f9f9dc5a002b211d657ca385f856c9c1c1eb7f8b..3c27360002d982e1ced1a15194dc55c8778412ea 100644 (file)
       }
     },
     "@types/estree": {
-      "version": "0.0.45",
-      "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.45.tgz",
-      "integrity": "sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g==",
+      "version": "0.0.46",
+      "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.46.tgz",
+      "integrity": "sha512-laIjwTQaD+5DukBZaygQ79K1Z0jb1bPEMRrkXSLjtCcZm+abyp5YbrqpSLzD42FwWW6gK/aS4NYpJ804nG2brg==",
       "dev": true
     },
     "@types/json-schema": {
       "dev": true
     },
     "@types/node": {
-      "version": "14.14.25",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz",
-      "integrity": "sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ==",
+      "version": "14.14.27",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.27.tgz",
+      "integrity": "sha512-Ecfmo4YDQPwuqTCl1yBxLV5ihKfRlkBmzUEDcfIRvDxOTGQEeikr317Ln7Gcv0tjA8dVgKI3rniqW2G1OyKDng==",
       "dev": true
     },
     "@types/offscreencanvas": {
       }
     },
     "eslint": {
-      "version": "7.19.0",
-      "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz",
-      "integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==",
+      "version": "7.20.0",
+      "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.20.0.tgz",
+      "integrity": "sha512-qGi0CTcOGP2OtCQBgWZlQjcTuP0XkIpYFj25XtRTQSHC+umNnp7UMshr2G8SLsRFYDdAPFeHOsiteadmMH02Yw==",
       "dev": true,
       "requires": {
-        "@babel/code-frame": "^7.0.0",
+        "@babel/code-frame": "7.12.11",
         "@eslint/eslintrc": "^0.3.0",
         "ajv": "^6.10.0",
         "chalk": "^4.0.0",
         "eslint-utils": "^2.1.0",
         "eslint-visitor-keys": "^2.0.0",
         "espree": "^7.3.1",
-        "esquery": "^1.2.0",
+        "esquery": "^1.4.0",
         "esutils": "^2.0.2",
         "file-entry-cache": "^6.0.0",
         "functional-red-black-tree": "^1.0.1",
         "v8-compile-cache": "^2.0.3"
       },
       "dependencies": {
+        "@babel/code-frame": {
+          "version": "7.12.11",
+          "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
+          "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
+          "dev": true,
+          "requires": {
+            "@babel/highlight": "^7.10.4"
+          }
+        },
         "ansi-regex": {
           "version": "5.0.0",
           "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
       "dev": true
     },
     "esquery": {
-      "version": "1.3.1",
-      "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz",
-      "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==",
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
+      "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
       "dev": true,
       "requires": {
         "estraverse": "^5.1.0"
         "moment": "^2.11.2"
       }
     },
+    "file-sync-cmp": {
+      "version": "0.1.1",
+      "resolved": "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz",
+      "integrity": "sha1-peeo/7+kk7Q7kju9TKiaU7Y7YSs=",
+      "dev": true
+    },
     "file-uri-to-path": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
         }
       }
     },
+    "grunt-contrib-clean": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/grunt-contrib-clean/-/grunt-contrib-clean-2.0.0.tgz",
+      "integrity": "sha512-g5ZD3ORk6gMa5ugZosLDQl3dZO7cI3R14U75hTM+dVLVxdMNJCPVmwf9OUt4v4eWgpKKWWoVK9DZc1amJp4nQw==",
+      "dev": true,
+      "requires": {
+        "async": "^2.6.1",
+        "rimraf": "^2.6.2"
+      },
+      "dependencies": {
+        "async": {
+          "version": "2.6.3",
+          "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
+          "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
+          "dev": true,
+          "requires": {
+            "lodash": "^4.17.14"
+          }
+        },
+        "rimraf": {
+          "version": "2.7.1",
+          "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+          "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+          "dev": true,
+          "requires": {
+            "glob": "^7.1.3"
+          }
+        }
+      }
+    },
+    "grunt-contrib-copy": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz",
+      "integrity": "sha1-cGDGWB6QS4qw0A8HbgqPbj58NXM=",
+      "dev": true,
+      "requires": {
+        "chalk": "^1.1.1",
+        "file-sync-cmp": "^0.1.0"
+      },
+      "dependencies": {
+        "ansi-regex": {
+          "version": "2.1.1",
+          "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+          "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+          "dev": true
+        },
+        "ansi-styles": {
+          "version": "2.2.1",
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+          "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+          "dev": true
+        },
+        "chalk": {
+          "version": "1.1.3",
+          "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+          "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+          "dev": true,
+          "requires": {
+            "ansi-styles": "^2.2.1",
+            "escape-string-regexp": "^1.0.2",
+            "has-ansi": "^2.0.0",
+            "strip-ansi": "^3.0.0",
+            "supports-color": "^2.0.0"
+          }
+        },
+        "strip-ansi": {
+          "version": "3.0.1",
+          "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+          "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+          "dev": true,
+          "requires": {
+            "ansi-regex": "^2.0.0"
+          }
+        },
+        "supports-color": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+          "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+          "dev": true
+        }
+      }
+    },
     "grunt-known-options": {
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz",
         }
       }
     },
+    "grunt-mkdir": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/grunt-mkdir/-/grunt-mkdir-1.1.0.tgz",
+      "integrity": "sha512-FRE17OYVveNbVJFX8GPGa5bzH2ZiAdBx3q0Kwk2Dg6l+TzLGaTdufUxiUWUbS2MERFacnmXZwDDOR5ZbYW0o+Q==",
+      "dev": true
+    },
     "grunt-ts": {
       "version": "6.0.0-beta.22",
       "resolved": "https://registry.npmjs.org/grunt-ts/-/grunt-ts-6.0.0-beta.22.tgz",
       },
       "dependencies": {
         "ajv": {
-          "version": "7.0.3",
-          "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz",
-          "integrity": "sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==",
+          "version": "7.1.0",
+          "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.1.0.tgz",
+          "integrity": "sha512-svS9uILze/cXbH0z2myCK2Brqprx/+JJYK5pHicT/GQiBfzzhUVAIT6MwqJg8y4xV/zoGsUeuPuwtoiKSGE15g==",
           "dev": true,
           "requires": {
             "fast-deep-equal": "^3.1.1",
index 5812d74a385f189ebe0df12e3ac9a1bc2c0c8238..b4fe270f9fbd3a955d5124a420a2f3d2a459d493 100644 (file)
   "main": "dist/start.js",
   "scripts": {
     "prestart": "npm run build",
-    "start": "node -r source-map-support/register dist/start.js",
-    "start:dev": "ts-node-dev -- src/start.ts",
-    "start:dev:debug": "ts-node-dev --inspect -- src/start.ts",
-    "start:debug": "node -r source-map-support/register --inspect dist/start.js",
-    "start:prof": "node -r source-map-support/register --prof dist/start.js",
-    "start:doctorprof": "clinic doctor -- node -r source-map-support/register dist/start.js",
-    "start:flameprof": "clinic flame -- node -r source-map-support/register dist/start.js",
-    "start:bubbleprof": "clinic bubbleprof -- node -r source-map-support/register dist/start.js",
+    "start": "cross-env NODE_ENV=production node -r source-map-support/register dist/start.js",
+    "start:debug": "cross-env NODE_ENV=production node -r source-map-support/register --inspect dist/start.js",
+    "start:prof": "cross-env NODE_ENV=production node -r source-map-support/register --prof dist/start.js",
+    "start:doctorprof": "cross-env NODE_ENV=production clinic doctor -- node -r source-map-support/register dist/start.js",
+    "start:flameprof": "cross-env NODE_ENV=production clinic flame -- node -r source-map-support/register dist/start.js",
+    "start:bubbleprof": "cross-env NODE_ENV=production clinic bubbleprof -- node -r source-map-support/register dist/start.js",
     "grunt": "grunt",
-    "build": "npm run build:prod",
+    "build": "npm run grunt",
     "build:mta": "mbt build",
-    "build:prod": "npm run grunt",
-    "build:dev": "npm run grunt -- ts:dev",
-    "build:clean": "rimraf ./dist",
+    "build:watch": "npm run grunt -- ts:buildWatch",
     "lint": "cross-env TIMING=1 eslint --ext .js,.ts src",
     "lint:fix": "cross-env TIMING=1 eslint --fix --ext .js,.ts src",
     "import-sort": "npx import-sort-cli --write 'src/**/*.ts{,x}'",
     "utf-8-validate": "^5.0.4"
   },
   "devDependencies": {
-    "@types/node": "^14.14.25",
+    "@types/node": "^14.14.27",
     "@types/uuid": "^8.3.0",
     "@types/ws": "^7.4.0",
     "@typescript-eslint/eslint-plugin": "^4.15.0",
     "@typescript-eslint/parser": "^4.15.0",
     "clinic": "^8.0.1",
     "cross-env": "^7.0.3",
-    "eslint": "^7.19.0",
+    "eslint": "^7.20.0",
     "grunt": "^1.3.0",
+    "grunt-contrib-clean": "^2.0.0",
+    "grunt-contrib-copy": "^1.0.0",
+    "grunt-mkdir": "^1.1.0",
     "grunt-ts": "^6.0.0-beta.22",
     "mbt": "^1.1.0",
     "npm-check": "^5.9.2",
-    "rimraf": "^3.0.2",
-    "ts-node-dev": "^1.1.1",
     "typescript": "^4.1.5"
   }
 }
index a7eef490e1611d0b6eabc4230ff60aa454632bc8..0bc2c30924ec67a35d15f269f9e01ee041570f34 100644 (file)
   "workerPoolMaxSize": 16,
   "stationTemplateURLs": [
     {
-      "file": "./src/assets/station-templates/siemens.station-template.json",
+      "file": "siemens.station-template.json",
       "numberOfStations": 1
     },
     {
-      "file": "./src/assets/station-templates/keba.station-template.json",
+      "file": "keba.station-template.json",
       "numberOfStations": 2
     },
     {
-      "file": "./src/assets/station-templates/abb.station-template.json",
+      "file": "abb.station-template.json",
       "numberOfStations": 2
     },
     {
-      "file": "./src/assets/station-templates/evlink.station-template.json",
+      "file": "evlink.station-template.json",
       "numberOfStations": 4
     },
     {
-      "file": "./src/assets/station-templates/schneider.station-template.json",
+      "file": "schneider.station-template.json",
       "numberOfStations": 1
     }
   ],
index 51d08d86d46e58e739deb9a75f9044f78b3c96fe..e72cca60a40fc383ff1c4f35aa93fff7fc169968 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 51d08d86d46e58e739deb9a75f9044f78b3c96fe
+Subproject commit e72cca60a40fc383ff1c4f35aa93fff7fc169968
index 875eed4577c51be45108cc165a10e0de0c431749..316f8b3eac6df74351d7e31d12e80d496361ff08 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-ABB",
   "nameSuffix": "-Roaming",
   "chargePointModel": "MD_TERRA_53",
index ce2025c9ffba33d0d3debc44836c7e96e343b4ae..3f743f966537f473db87b9c88af59c2be4d6a9a5 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-ABB",
   "chargePointModel": "MD_TERRA_53",
   "chargePointVendor": "ABB",
index aebc3d0546fc285f3deff485503f62c48a280127..74436fc3f4955b67b1f18e29f2d8634f17fe72f8 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-EVLINK",
   "chargePointModel": "MONOBLOCK",
   "chargePointVendor": "Schneider Electric",
index b1337fc7468d4fb71bed0b0c9017f71e6daba0dc..236f0ce5cc25b5312ce322de626d4454336c7b6b 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-KEBA",
   "chargePointModel": "KC-P30-ESS400C2-E0R",
   "chargePointVendor": "Keba AG",
index e82998e16f6e94746f4f2ef02954c34c16df1612..6daad3a7601c5ee77fece24599163caa56bf1a23 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-SCHNEIDER",
   "chargePointModel": "MONOBLOCK",
   "chargePointVendor": "Schneider Electric",
index 1502c595b6a95ca8a2eee6f2da5a455beec9b8e9..353ad567541409e6428ef01b959eb3f9961f5f83 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-SCHNEIDER",
   "chargePointModel": "MONOBLOCK",
   "chargePointVendor": "Schneider Electric",
index 0f48b40489477bc6e6d7a74d3ffa2e3df4abeb04..fa05caf0d9ca1533fd39df8a29703b824458ea94 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-SIEMENS",
   "fixedName": true,
   "chargePointModel": "SIEMENSXX213",
index 6b9df513d78937c3584769220a63c2c0669d5b6a..0da43ac6de86c80489071b3ffdf84ab3a4dba53a 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-BASIC",
   "chargePointModel": "Simulator simple",
   "chargePointVendor": "Ovomaltin",
index 63e4c1435f6795615adbf5f8d18624fa75a39b67..f251d2c4b73448881ae608d879a9cfc8d4d92d06 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-BASIC",
   "chargePointModel": "Simulator simple",
   "chargePointVendor": "Ovomaltin",
index a28fccf5f2102c551ef6634b331963b51bab1d63..8cb63eb6967684086bfba8e6cb5a034efd37c748 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "authorizationFile": "./src/assets/authorization-tags.json",
+  "authorizationFile": "authorization-tags.json",
   "baseName": "CS-SIMU",
   "chargePointModel": "Simulator connectors",
   "chargePointVendor": "Ovomaltin",
index 8c6d415a8198367639776712209b51e249720d4f..486b4fcd8445b805eb92f8eabeb4298b97db96b0 100644 (file)
@@ -4,6 +4,7 @@ import Utils from '../utils/Utils';
 import WorkerFactory from '../worker/WorkerFactory';
 import Wrk from '../worker/Wrk';
 import { isMainThread } from 'worker_threads';
+import path from 'path';
 
 export default class Bootstrap {
   private static instance: Bootstrap;
@@ -13,7 +14,7 @@ export default class Bootstrap {
 
   private constructor() {
     this.started = false;
-    this.workerScript = './dist/charging-station/StationWorker.js';
+    this.workerScript = path.join(path.resolve(__dirname, '../'), 'charging-station', 'StationWorker.js');
   }
 
   public static getInstance(): Bootstrap {
@@ -36,7 +37,7 @@ export default class Bootstrap {
               for (let index = 1; index <= nbStations; index++) {
                 const workerData: StationWorkerData = {
                   index,
-                  templateFile: stationURL.file
+                  templateFile: path.join(path.resolve(__dirname, '../'), 'assets', 'station-templates', path.basename(stationURL.file))
                 };
                 await this.getWorkerImplementationInstance().addElement(workerData);
                 numStationsTotal++;
index 0c39613beefea49afdb1a3701457daba98fa12ee..411c452217e7e166bf77a47a1bf486836054616c 100644 (file)
@@ -29,6 +29,7 @@ import { WebSocketCloseEventStatusCode } from '../types/WebSocket';
 import crypto from 'crypto';
 import fs from 'fs';
 import logger from '../utils/Logger';
+import path from 'path';
 
 export default class ChargingStation {
   public stationTemplateFile: string;
@@ -598,7 +599,7 @@ export default class ChargingStation {
   }
 
   private getAuthorizationFile(): string {
-    return this.stationInfo.authorizationFile && this.stationInfo.authorizationFile;
+    return this.stationInfo.authorizationFile && path.join(path.resolve(__dirname, '../'), 'assets', path.basename(this.stationInfo.authorizationFile));
   }
 
   private getAuthorizedTags(): string[] {
index 6d1f7ccfd06ee85df55e8d2fccfeb5f33c18c9c7..99519b7da3086ba9883e212ced852e3fbfbccff5 100644 (file)
@@ -3,9 +3,10 @@ import ConfigurationData, { StationTemplateURL } from '../types/ConfigurationDat
 import Bootstrap from '../charging-station/Bootstrap';
 import { WorkerProcessType } from '../types/Worker';
 import fs from 'fs';
+import path from 'path';
 
 export default class Configuration {
-  private static configurationFilePath = './src/assets/config.json';
+  private static configurationFilePath = path.join(path.resolve(__dirname, '../'), 'assets', 'config.json');
   private static configurationFileWatcher: fs.FSWatcher;
   private static configuration: ConfigurationData;