From c76ed6bddb5ad8dd7095863215c56f172b7d8025 Mon Sep 17 00:00:00 2001 From: Pranav Jain Date: Tue, 14 Feb 2023 15:39:31 +0530 Subject: [PATCH 1/4] add code to read from process.env vars --- lib/config/constants.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/config/constants.js b/lib/config/constants.js index 4ce82a3..ed7adf7 100644 --- a/lib/config/constants.js +++ b/lib/config/constants.js @@ -111,15 +111,25 @@ class ConfigParser { setUpstream() { this.upstream = config.upstream; + + if (process.env.CDP_UPSTREAM) { + this.upstream = process.env.CDP_UPSTREAM; + } + return this; } setPort() { - const { port } = config; + let { port } = config; + + if (process.env.CDP_PORT) { + port = Number(process.env.CDP_PORT); + } + let portVal; if (isNotNumber(port)) { - logger.info('Not a valid port number, using default (8081)'); - portVal = 8081; + logger.info('Not a valid port number, using default (9222)'); + portVal = 9222; } else { portVal = port; } @@ -128,7 +138,12 @@ class ConfigParser { } setHostname() { - const { hostname } = config; + let { hostname } = config; + + if (process.env.HOST) { + hostname = process.env.HOST; + } + let hostnameVal; if (isNotString(hostname)) { logger.info('Not a valid port number, using default (8081)'); From e3b114913867d7f8ea34cc7b1cb8ecdfbbca1d2c Mon Sep 17 00:00:00 2001 From: Pranav Jain Date: Tue, 14 Feb 2023 15:41:34 +0530 Subject: [PATCH 2/4] change prod env port in sample file --- lib/config/config.json.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config/config.json.sample b/lib/config/config.json.sample index 58a4227..e60fe41 100644 --- a/lib/config/config.json.sample +++ b/lib/config/config.json.sample @@ -1,7 +1,7 @@ { "prod": { "workers": 1, - "port": 9124, + "port": 9222, "hostname": "127.0.0.1", "upstream": "ws://localhost:9125", "retryDelay": 10000, From 1bcc633e1578b98d7efda682c178bd54e2668cdd Mon Sep 17 00:00:00 2001 From: Archish Date: Thu, 16 Feb 2023 10:42:23 +0530 Subject: [PATCH 3/4] :art: adding config.json --- .gitignore | 1 - lib/config/config.json | 32 ++++++++++++++++++++++++++++++++ lib/config/config.json.sample | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 lib/config/config.json diff --git a/.gitignore b/.gitignore index e4435a8..a1446b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ node_modules tmp/ -config.json .nyc_output logs/ diff --git a/lib/config/config.json b/lib/config/config.json new file mode 100644 index 0000000..2b918bd --- /dev/null +++ b/lib/config/config.json @@ -0,0 +1,32 @@ +{ + "prod": { + "workers": 1, + "port": 9222, + "hostname": "127.0.0.1", + "upstream": "ws://localhost:9125", + "retryDelay": 10000, + "closeTimer": 15000, + "enableInstrumentation": true, + "instrumentationTimer": 60000 + }, + "test": { + "workers": 1, + "port": 8999, + "hostname": "127.0.0.1", + "upstream": "ws://localhost:8999", + "retryDelay": 10000, + "closeTimer": 15000, + "enableInstrumentation": true, + "instrumentationTimer": 60000 + }, + "dev": { + "workers": 1, + "port": 9222, + "hostname": "127.0.0.1", + "upstream": "ws://localhost:9125", + "retryDelay": 10000, + "closeTimer": 15000, + "enableInstrumentation": true, + "instrumentationTimer": 60000 + } +} diff --git a/lib/config/config.json.sample b/lib/config/config.json.sample index e60fe41..2b918bd 100644 --- a/lib/config/config.json.sample +++ b/lib/config/config.json.sample @@ -21,7 +21,7 @@ }, "dev": { "workers": 1, - "port": 9124, + "port": 9222, "hostname": "127.0.0.1", "upstream": "ws://localhost:9125", "retryDelay": 10000, From 4bdb5988c8d20e3cdaddcaa156acf6b8eea13d90 Mon Sep 17 00:00:00 2001 From: hariharanbrowserstack Date: Wed, 10 Jul 2024 22:22:29 +0530 Subject: [PATCH 4/4] WS Package upgrade due to security vulnerability --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 08b1ce2..9f61cc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3033,9 +3033,9 @@ } }, "ws": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", - "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==" + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==" }, "y18n": { "version": "5.0.8", diff --git a/package.json b/package.json index edcba04..426cbe0 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "pino": "^6.11.3", "pino-pretty": "^5.1.2", "uuid": "^8.3.2", - "ws": "^7.5.0" + "ws": "^7.5.10" }, "devDependencies": { "chai": "^4.3.4",