@nsshunt/stsconfig 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env-default CHANGED
@@ -220,3 +220,9 @@ SYSTEM_INFORMATION_INTERVAL=1000
220
220
 
221
221
  # Ignore socket.io REST api calls and/or WebSocket calls when collecting telemetry for instrumentation purposes.
222
222
  IGNORE_SOCKETIO=true
223
+
224
+ # HTTPS server key path.
225
+ HTTPS_SERVER_KEY_PATH=/var/lib/sts/stsglobalresources/keys/server.key
226
+
227
+ # HTTPS server cert path.
228
+ HTTPS_SERVER_CERT_PATH=/var/lib/sts/stsglobalresources/keys/server.cert
package/.env-test-file-2 CHANGED
@@ -119,3 +119,5 @@ CHILD_PROCESS_EXIT_TIME=5000
119
119
  SYSTEM_INFORMATION_INTERVAL=10000
120
120
  IGNORE_SOCKETIO=false
121
121
  MODEL_PURGE_UPDATE_TIMEOUT=50000
122
+ HTTPS_SERVER_KEY_PATH=/var/lib/sts/stsglobalresources/keys/server.key-c
123
+ HTTPS_SERVER_CERT_PATH=/var/lib/sts/stsglobalresources/keys/server.cert-c
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsconfig",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "",
5
5
  "main": "stsconfig.js",
6
6
  "dependencies": {
@@ -161,7 +161,7 @@ describe("Test implicit config settings", () =>
161
161
 
162
162
  test('Checking default additional config items', async () =>
163
163
  {
164
- expect.assertions(20);
164
+ expect.assertions(22);
165
165
 
166
166
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
167
167
  let goptions = require('./stsconfig.js').$options;
@@ -186,6 +186,8 @@ describe("Test implicit config settings", () =>
186
186
  expect(goptions.childProcessExitTime).toEqual(500);
187
187
  expect(goptions.systemInformationInterval).toEqual(1000);
188
188
  expect(goptions.ignoresocketio).toEqual(true);
189
+ expect(goptions.httpsserverkeypath).toEqual('/var/lib/sts/stsglobalresources/keys/server.key');
190
+ expect(goptions.httpsservercertpath).toEqual('/var/lib/sts/stsglobalresources/keys/server.cert');
189
191
  });
190
192
  });
191
193
 
@@ -161,7 +161,7 @@ describe("Test configured settings", () =>
161
161
 
162
162
  test('Checking default additional config items', async () =>
163
163
  {
164
- expect.assertions(20);
164
+ expect.assertions(22);
165
165
 
166
166
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
167
167
  let goptions = require('./stsconfig.js').$options;
@@ -186,6 +186,8 @@ describe("Test configured settings", () =>
186
186
  expect(goptions.childProcessExitTime).toEqual(5000);
187
187
  expect(goptions.systemInformationInterval).toEqual(10000);
188
188
  expect(goptions.ignoresocketio).toEqual(false);
189
+ expect(goptions.httpsserverkeypath).toEqual('/var/lib/sts/stsglobalresources/keys/server.key-c');
190
+ expect(goptions.httpsservercertpath).toEqual('/var/lib/sts/stsglobalresources/keys/server.cert-c');
189
191
  });
190
192
  });
191
193
 
@@ -161,7 +161,7 @@ describe("Test explicit default config settings", () =>
161
161
 
162
162
  test('Checking default additional config items', async () =>
163
163
  {
164
- expect.assertions(20);
164
+ expect.assertions(22);
165
165
 
166
166
  process.env.STSENVFILE = './.env-default'; // Empty environment file
167
167
  let goptions = require('./stsconfig.js').$options;
@@ -186,6 +186,8 @@ describe("Test explicit default config settings", () =>
186
186
  expect(goptions.childProcessExitTime).toEqual(500);
187
187
  expect(goptions.systemInformationInterval).toEqual(1000);
188
188
  expect(goptions.ignoresocketio).toEqual(true);
189
+ expect(goptions.httpsserverkeypath).toEqual('/var/lib/sts/stsglobalresources/keys/server.key');
190
+ expect(goptions.httpsservercertpath).toEqual('/var/lib/sts/stsglobalresources/keys/server.cert');
189
191
  });
190
192
  });
191
193
 
package/stsconfig.js CHANGED
@@ -323,6 +323,14 @@ const defconfig =
323
323
  // activity has been detected. Default 5 seconds.
324
324
  ,modelPurgeUpdateTimeout: (process.env.MODEL_PURGE_UPDATE_TIMEOUT === undefined ? 5000 : parseInt(process.env.MODEL_PURGE_UPDATE_TIMEOUT))
325
325
  */
326
+
327
+ // Use command below to create self signed cert;
328
+ // openssl req -nodes -new -x509 -keyout server.key -out server.cert
329
+ // Ref: https://www.geeksforgeeks.org/how-to-create-https-server-with-node-js/
330
+ // HTTPS server key path.
331
+ ,httpsserverkeypath: (process.env.HTTPS_SERVER_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH)
332
+ // HTTPS server cert path.
333
+ ,httpsservercertpath: (process.env.HTTPS_SERVER_CERT_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH)
326
334
  }
327
335
 
328
336
  const ReadFile = (passwordFile) => {