@nsshunt/stsconfig 1.12.0 → 1.14.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 ADDED
@@ -0,0 +1,249 @@
1
+ # ==================================================================================================
2
+ # Default configuration settings
3
+ # ==================================================================================================
4
+ # Log error messages to the console within the microservice
5
+ CONSOLE_LOG_ERRORS=false
6
+ # Database username.
7
+ DB_USER=postgres
8
+ # Database password.
9
+ DB_PASSWORD=password
10
+ # Database password file
11
+ #DB_PASSWORD_FILE
12
+ # Database host
13
+ DB_HOST=localhost
14
+ # Database port
15
+ DB_PORT=5432
16
+ # Database name.
17
+ DB_DATABASE=stsrestmsdb01
18
+ # Database connection string to be used in production mode
19
+ #DATABASE_URL=
20
+ # Database script(s) folder
21
+ DB_SCRIPT_FOLDER=/var/lib/sts/stsglobalresources/db-scripts
22
+
23
+ # The maximum pool size for pg. There will be one pool per thread.
24
+ POOL_SIZE=500
25
+ # Maximum number of CPUs (incl. logical processors) to use within the Microservice.
26
+ # Use -1 to use all available within the runtime container. Each CPU will spawn a node work thread.
27
+ MAX_CPU=-1
28
+ # Automatically re-spawn a worker thread if one dies.
29
+ RESPAWN=false
30
+ # Default number of entries to create for a fresh database.
31
+ DEFAULT_DB_ENTRIES=10000
32
+ # Microservice listen port.
33
+ USE_REDIS=false
34
+ # Use redis for Microservice.
35
+ USE_L1_REDIS=false
36
+ # Automatically flush the redis cache when terminating the Microservice.
37
+ REDIS_END_FLUSH=false
38
+ # Redis server port.
39
+ REDIS_PORT=6379
40
+ # Redis server endpoint.
41
+ REDIS_SERVER=localhost
42
+ # Default K6 test script path
43
+ K6SCRIPTPATH=.
44
+ # Default number of entries to create for a fresh database.
45
+ DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE=0
46
+ # Default number of entries to create for a fresh database.
47
+ DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE=2000
48
+
49
+ # STSREST01 Server endpoint
50
+ REST01_ENDPOINT=http://localhost
51
+ # STSREST01 Server port (listen port for the service)
52
+ REST01_HOST_PORT=3003
53
+ # STSREST01 Server port (client port to access the service)
54
+ REST01_PORT=3003
55
+ # STSREST01 Server endpoint
56
+ REST01_APIROOT=/stsrest01/v1
57
+ # STSREST01 Prometheus metric support
58
+ REST01_PROM_SUPPORT=true
59
+ # STSREST01 Cluster Server port (port used for cluster prometheus scrapes). Service will listen on this port at mount point /metrics
60
+ REST01_PROM_CLUSTER_PORT=3013
61
+ # STSREST01 Service Name
62
+ REST01_SERVICE_NAME=STSRest01
63
+ # STSREST01 Service Version
64
+ REST01_SERVICE_VERSION=1.0.0
65
+ # STSREST01 Service Credentials
66
+ # -----------------------------
67
+ # STSREST01 Server username email
68
+ REST01_EMAIL=STSREST01ServiceUser@stsmda.com
69
+ # STSREST01 Server username password
70
+ REST01_PASSWORD=STSREST01ServiceUserPassword
71
+ # STSREST01 Server username password file
72
+ #REST01_PASSWORD_FILE
73
+
74
+ # STS Instrument Manager Service endpoint
75
+ IM_ENDPOINT=http://localhost
76
+ # STS Instrument Manager Service listen port (listen port for the service)
77
+ IM_HOST_PORT=3001
78
+ # STS Instrument Manager Service client access port (client port to access the service)
79
+ IM_PORT=3001
80
+ # STS Instrument Manager Service endpoint
81
+ IM_APIROOT=/stsinstrumentmanager/v1
82
+ # STS Instrument Manager Prometheus metric support
83
+ IM_PROM_SUPPORT=true
84
+ # STS Instrument Manager Cluster Server port (port used for cluster prometheus scrapes)
85
+ IM_PROM_CLUSTER_PORT=3011
86
+ # STS Instrument Manager Service Name
87
+ IM_SERVICE_NAME=STSInstrumentManager
88
+ # STS Instrument Manager Service Version
89
+ IM_SERVICE_VERSION=1.0.0
90
+ # STS Instrument Manager Service Credentials
91
+ # ------------------------------------------
92
+ # STS Instrument Manager Service username email
93
+ IM_EMAIL=STSInstrumentManagerServiceUser@stsmda.com
94
+ # STS Instrument Manager Service username password
95
+ IM_PASSWORD=STSInstrumentManagerServiceUserPassword
96
+ # STS Instrument Manager Service username password file
97
+ #IM_PASSWORD_FILE
98
+
99
+ # STS Test Orchestrator Service endpoint
100
+ TO_ENDPOINT=http://localhost
101
+ # STS Test Orchestrator Service listen port (listen port for the service)
102
+ TO_HOST_PORT=3004
103
+ # STS Test Orchestrator Service client access port (client port to access the service)
104
+ TO_PORT=3004
105
+ # STS Test Orchestrator Service endpoint
106
+ TO_APIROOT=/ststestorchestrator/v1
107
+ # STS Test Orchestrator Prometheus metric support
108
+ TO_PROM_SUPPORT=true
109
+ # STS Test Orchestrator Cluster Server port (port used for cluster prometheus scrapes)
110
+ TO_PROM_CLUSTER_PORT=3014
111
+ # STS Test Orchestrator Service Name
112
+ TO_SERVICE_NAME=STSTestOrchestrator
113
+ # STS Test Orchestrator Service Version
114
+ TO_SERVICE_VERSION=1.0.0
115
+ # STS Test Orchestrator Service Credentials
116
+ # ------------------------------------------
117
+ # STS Test Orchestrator Service username email
118
+ TO_EMAIL=STSTestOrchestratorServiceUser@stsmda.com
119
+ # STS Test Orchestrator Service username password
120
+ TO_PASSWORD=STSTestOrchestratorServiceUserPassword
121
+ # STS Test Orchestrator Service username password file
122
+ #TO_PASSWORD_FILE
123
+
124
+ # Auth Server endpoint
125
+ AS_ENDPOINT=http://localhost
126
+ # Auth Server host port (listen port for the service)
127
+ AS_HOST_PORT=3002
128
+ # Auth Server port (client port to access the service)
129
+ AS_PORT=3002
130
+ # Auth Server endpoint
131
+ AS_APIROOT=/stsauth/v1
132
+ # Auth Server Prometheus metric support
133
+ AS_PROM_SUPPORT=true
134
+ # Auth Prometheus Cluster Server port (port used for cluster prometheus scrapes)
135
+ AS_PROM_CLUSTER_PORT=3012
136
+ # STSAuth Service Name
137
+ AS_SERVICE_NAME=STSAuth
138
+ # STSAuth Service Version
139
+ AS_SERVICE_VERSION=1.0.0
140
+ # STS Auth Service Credentials
141
+ # ----------------------------
142
+ # Auth Server username email
143
+ AS_EMAIL=STSAuthServiceUser@stsmda.com
144
+ # Auth Server username password
145
+ AS_PASSWORD=STSAuthServiceUserPassword
146
+ # Auth Server username password file
147
+ #AS_PASSWORD_FILE
148
+ # Auth Server - Private Key (when using JWT)
149
+ AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key
150
+ # Auth Server - Public Key (when using JWT)
151
+ AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key
152
+
153
+ # STS Test Runner Prometheus metric support
154
+ TR_PROM_SUPPORT=true
155
+ # STS Test Runner Cluster Server port (port used for cluster prometheus scrapes)
156
+ TR_PROM_CLUSTER_PORT=3015
157
+ # STS Test Runner Service Name
158
+ TR_SERVICE_NAME=STSRestRunner
159
+ # STS Test Runner Service Version
160
+ TR_SERVICE_VERSION=1.0.0
161
+ # STS Test Runner Credentials
162
+ # ----------------------------
163
+ # STS Test Runner username email
164
+ TR_EMAIL=STSTestRunnerServiceUser@stsmda.com
165
+ # STS Test Runner password
166
+ TR_PASSWORD=STSTestRunnerServiceUserPassword
167
+ # STS Test Runner password file
168
+ #TR_PASSWORD_FILE
169
+
170
+ # Duration (in ms) between each publish event.
171
+ PUBLISH_INTERVAL=1000
172
+
173
+ # The maximum time (in ms) to wait before timeout error when publishing instruments. Ideally, this should always be lower than the publishinterval frequency
174
+ # to avoid cascading http build up errors.
175
+ PUBLISH_TIMEOUT=750
176
+
177
+ # If true, instrument publish failures will be logged to debug output.
178
+ PUBLISH_DEBUG=false
179
+
180
+ # Transport(s) to use for sending instrumentation data to the instrumentation server
181
+ TRANSPORT=RESTAPI
182
+
183
+ # Use secure cookies option when passing back cookies from STS services (such as STSAuth service).
184
+ # This setting will be ignore for production mode. In production mode services will always use secure cookies.
185
+ USE_SECURE_COOKIES=false
186
+
187
+ # keepAlive <boolean> Keep sockets around even when there are no outstanding requests, so they can be used for future requests without having to reestablish a
188
+ # TCP connection. Not to be confused with the keep-alive value of the Connection header. The Connection: keep-alive header is always sent when using an agent
189
+ # except when the Connection header is explicitly specified or when the keepAlive and maxSockets options are respectively set to false and Infinity, in which
190
+ # case Connection: close will be used. Default: false.
191
+ # Reference: https://nodejs.org/api/http.html#class-httpagent
192
+ KEEP_ALIVE=true
193
+
194
+ # maxSockets <number> Maximum number of sockets to allow per host. If the same host opens multiple concurrent connections, each request will use new socket until the
195
+ # maxSockets value is reached. If the host attempts to open more connections than maxSockets, the additional requests will enter into a pending request queue, and will
196
+ # enter active connection state when an existing connection terminates. This makes sure there are at most maxSockets active connections at any point in time,
197
+ # from a given host. Default: Infinity.
198
+ # Reference: https://nodejs.org/api/http.html#class-httpagent
199
+ MAX_SOCKETS=10
200
+
201
+ # maxTotalSockets <number> Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
202
+ # Reference: https://nodejs.org/api/http.html#class-httpagent
203
+ MAX_TOTAL_SOCKETS=20
204
+
205
+ # maxFreeSockets <number> Maximum number of sockets per host to leave open in a free state. Only relevant if keepAlive is set to true. Default: 256.
206
+ # Reference: https://nodejs.org/api/http.html#class-httpagent
207
+ MAX_FREE_SOCKETS=256
208
+
209
+ # timeout <number> Socket timeout in milliseconds. This will set the timeout when the socket is created.
210
+ # Reference: https://nodejs.org/api/http.html#class-httpagent
211
+ TIMEOUT=10000
212
+
213
+ # Maximum payload size allowed for express server calls
214
+ MAX_PAYLOAD_SIZE='50mb'
215
+
216
+ # Instrumentation Config Settings
217
+ # -------------------------------
218
+ # Generic interval (ms) to make on observation for instrumentation objects.
219
+ INSTRUMENTATION_OBSERVATION_INTERVAL=1000
220
+
221
+ # Generic sliding time window (seconds) for instrumentation objects that process telemetry over time (e.g. P(x) instruments).
222
+ INSTRUMENTATION_TIME_WINDOW=600
223
+
224
+ # Service Specific Config Settings
225
+ # --------------------------------
226
+ # STSAuth
227
+ # -------
228
+ # Define the valid age for a JWT access token (in ms). Default 10 minutes.
229
+ AUTH_JWT_ACCESS_TOKEN_TIMEOUT=600
230
+
231
+ # Define the valid age for a JWT refresh token (in ms). Default 24 hours.
232
+ AUTH_JWT_REFRESH_TOKEN_TIMEOUT=86400
233
+
234
+ # Define the valid age for an authentication/session cookie. Default 24 hours.
235
+ AUTH_COOKIE_TIMEOUT=86400
236
+
237
+ # STSAppFramework (library)
238
+ # -------------------------
239
+ # Define the time (ms) to wait prior to exiting the application (using process.exit(0))
240
+ MASTER_PROCESS_EXIT_TIME=500
241
+
242
+ # Define the time (ms) to wait prior to exiting the application (using process.exit(0))
243
+ CHILD_PROCESS_EXIT_TIME=500
244
+
245
+ # Define the interval (ms) to collect system information for instrumentation purposes
246
+ SYSTEM_INFORMATION_INTERVAL=1000
247
+
248
+ # Ignore socket.io REST api calls and/or WebSocket calls when collecting telemetry for instrumentation purposes.
249
+ IGNORE_SOCKETIO=true
package/.env-test-file-2 CHANGED
@@ -1,167 +1,103 @@
1
- #.env
2
- # ==================================================================================================
3
- # Development Settings
4
- # ==================================================================================================
5
- # Database username
6
- DB_USER=postgres
7
- # Database password
8
- #DB_PASSWORD=somepassword
9
- # Database password file. To create, use 'echo -n [password] > /home/marcusbettens/projects/dbpassword'
10
- # This will set the database password to the contents of the dbpassword file without the trailing /cr character.
11
- DB_PASSWORD_FILE=/home/marcusbettens/projects/dbpassword
12
- # Database host
13
- DB_HOST=localhost
14
- # Database port
15
- DB_PORT=5432
16
- # Database name
17
- DB_DATABASE=testdb17
18
- # Maximum pool size for database connections (per thread)
19
- POOL_SIZE=200
20
- # Database Script Folder
21
- DB_SCRIPT_FOLDER=/var/lib/sts/stsglobalresources/db-scripts
22
- # sudo mkdir /var/run/sts
23
- # sudo chown marcusbettens /var/run/sts
24
- #PORT=/var/run/sts/stsrest01.sock
1
+ NODE_ENV=production
2
+ CONSOLE_LOG_ERRORS=true
3
+ DB_USER=postgres-c
4
+ DB_PASSWORD=password-c
5
+ DB_PASSWORD_FILE=testpasswordfile
6
+ DB_HOST=localhost-c
7
+ DB_PORT=54320
8
+ DB_DATABASE=stsrestmsdb01-c
9
+ DATABASE_URL=-c
10
+ DB_SCRIPT_FOLDER=/var/lib/sts/stsglobalresources/db-scripts-c
25
11
 
26
- PUBLISH_DEBUG=false
27
- PUBLISH_TIMEOUT=750
28
- PUBLISH_INTERVAL=1000
12
+ POOL_SIZE=5000
13
+ MAX_CPU=-10
14
+ RESPAWN=true
15
+ DEFAULT_DB_ENTRIES=100000
16
+ USE_REDIS=true
17
+ USE_L1_REDIS=true
18
+ REDIS_END_FLUSH=true
19
+ REDIS_PORT=63790
20
+ REDIS_SERVER=localhost-c
21
+ K6SCRIPTPATH=.-c
22
+ DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE=1
23
+ DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE=20000
29
24
 
30
- # STSRest01 service host and connection details
31
- REST01_ENDPOINT=http://localhost
32
- REST01_HOST_PORT=3003
33
- REST01_PORT=3003
34
- REST01_APIROOT=/stsrest01/v1
35
- REST01_EMAIL=K6TestUser@sts
36
- #REST01_PASSWORD=somepassword
37
- REST01_PASSWORD_FILE=/home/marcusbettens/projects/rest01passwordfile
38
- REST01_SERVICE_NAME=STSRest01
39
- REST01_SERVICE_VERSION=1.0.0
40
- REST01_PROM_SUPPORT=true
41
- REST01_PROM_CLUSTER_PORT=3013
25
+ REST01_ENDPOINT=http://localhost-c
26
+ REST01_HOST_PORT=30030
27
+ REST01_PORT=30030
28
+ REST01_APIROOT=/stsrest01/v1-c
29
+ REST01_PROM_SUPPORT=false
30
+ REST01_PROM_CLUSTER_PORT=30130
31
+ REST01_SERVICE_NAME=STSRest01-c
32
+ REST01_SERVICE_VERSION=1.0.0-c
33
+ REST01_EMAIL=K6TestUser@sts-c
34
+ REST01_PASSWORD=K6TestUserPassword-c
35
+ REST01_PASSWORD_FILE=testpasswordfile
42
36
 
43
- # STSInstrumentManager service host and connection details
44
- IM_ENDPOINT=http://localhost
45
- IM_HOST_PORT=3001
46
- IM_PORT=3001
47
- IM_APIROOT=/stsinstrumentmanager/v1
48
- IM_EMAIL=K6TestUser@sts
49
- #IM_PASSWORD=K6TestUserPassword
50
- IM_PASSWORD_FILE=/home/marcusbettens/projects/impasswordfile
51
- IM_SERVICE_NAME=STSInstrumentManager
52
- IM_SERVICE_VERSION=1.0.0
53
- IM_PROM_SUPPORT=true
54
- IM_PROM_CLUSTER_PORT=3011
37
+ IM_ENDPOINT=http://localhost-c
38
+ IM_HOST_PORT=30010
39
+ IM_PORT=30010
40
+ IM_APIROOT=/stsinstrumentmanager/v1-c
41
+ IM_PROM_SUPPORT=false
42
+ IM_PROM_CLUSTER_PORT=30110
43
+ IM_SERVICE_NAME=STSInstrumentManager-c
44
+ IM_SERVICE_VERSION=1.0.0-c
45
+ IM_EMAIL=K6TestUser@sts-c
46
+ IM_PASSWORD=K6TestUserPassword-c
47
+ IM_PASSWORD_FILE=testpasswordfile
55
48
 
56
- # STSAuth service host and connection details
57
- AS_ENDPOINT=http://localhost
58
- AS_HOST_PORT=3002
59
- AS_PORT=3002
60
- AS_APIROOT=/stsauth/v1
61
- AS_EMAIL=K6TestUser@sts
62
- #AS_PASSWORD=K6TestUserPassword
63
- AS_PASSWORD_FILE=/home/marcusbettens/projects/aspasswordfile
64
- AS_SERVICE_NAME=STSAuth
65
- AS_SERVICE_VERSION=1.0.0
66
- AS_PROM_SUPPORT=true
67
- AS_PROM_CLUSTER_PORT=3012
49
+ TO_ENDPOINT=http://localhost-c
50
+ TO_HOST_PORT=30040
51
+ TO_PORT=30040
52
+ TO_APIROOT=/ststestorchestrator/v1-c
53
+ TO_PROM_SUPPORT=false
54
+ TO_PROM_CLUSTER_PORT=30140
55
+ TO_SERVICE_NAME=STSTestOrchestrator-c
56
+ TO_SERVICE_VERSION=1.0.0-c
57
+ TO_EMAIL=K6TestUser@sts-c
58
+ TO_PASSWORD=K6TestUserPassword-c
59
+ TO_PASSWORD_FILE=testpasswordfile
68
60
 
69
- # STS Test Orchestrator service host and connection details
70
- TO_ENDPOINT=http://localhost
71
- TO_HOST_PORT=3004
72
- TO_PORT=3004
73
- TO_APIROOT=/ststestorchestrator/v1
74
- TO_EMAIL=K6TestUser@sts
75
- #TO_PASSWORD=somepassword
76
- TO_PASSWORD_FILE=/home/marcusbettens/projects/topasswordfile
77
- TO_SERVICE_NAME=STSTestOrchestrator
78
- TO_SERVICE_VERSION=1.0.0
79
- TO_PROM_SUPPORT=true
80
- TO_PROM_CLUSTER_PORT=3014
61
+ AS_ENDPOINT=http://localhost-c
62
+ AS_HOST_PORT=30020
63
+ AS_PORT=30020
64
+ AS_APIROOT=/stsauth/v1-c
65
+ AS_PROM_SUPPORT=false
66
+ AS_PROM_CLUSTER_PORT=30120
67
+ AS_SERVICE_NAME=STSAuth-c
68
+ AS_SERVICE_VERSION=1.0.0-c
69
+ AS_EMAIL=K6TestUser@sts-c
70
+ AS_PASSWORD=K6TestUserPassword-c
71
+ AS_PASSWORD_FILE=testpasswordfile
72
+ AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key-c
73
+ AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key-c
81
74
 
82
- # STS Test Runner service host and connection details
83
- TR_EMAIL=K6TestUser@sts
84
- #TR_PASSWORD=somepassword
85
- TR_PASSWORD_FILE=/home/marcusbettens/projects/trpasswordfile
86
- TR_SERVICE_NAME=STSRestRunner
87
- TR_SERVICE_VERSION=1.0.0
88
- TR_PROM_SUPPORT=true
89
- TR_PROM_CLUSTER_PORT=3015
75
+ TR_PROM_SUPPORT=false
76
+ TR_PROM_CLUSTER_PORT=30150
77
+ TR_SERVICE_NAME=STSRestRunner-c
78
+ TR_SERVICE_VERSION=1.0.0-c
79
+ TR_EMAIL=K6TestUser@sts-c
80
+ TR_PASSWORD=K6TestUserPassword-c
81
+ TR_PASSWORD_FILE=testpasswordfile
90
82
 
91
- # Auth Server public and private key paths
92
- AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key
93
- AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key
94
-
95
- # Node runtime environment
96
- NODE_ENV=debug
97
- # Default K6 test script path
98
- K6SCRIPTPATH=.
99
- # Redis server end point
100
- REDIS_SERVER=localhost
101
- # Redis server port
102
- REDIS_PORT=6379
103
- # Use redis for Microservice
104
- USE_REDIS=false
105
- # Use redis as a layer 1 cache
106
- USE_L1_REDIS=false
107
- # Automatically flush the redis cache when terminating the Microservice
108
- REDIS_END_FLUSH=false
109
- # Log error messages to the console within the microservice
110
- CONSOLE_LOG_ERRORS=false
111
- # Maximum number of CPUs (incl. logical processors) to use within the Microservice.
112
- # Use -1 to use all available within the runtime container. Each CPU will spawn a node work thread.
113
- MAX_CPU=2
114
- # Automatically re-spawn a worker thread if one dies.
115
- RESPAWN=false
116
- # Default number of entries to create for a fresh database
117
- DEFAULT_DB_ENTRIES=10000
118
- # Default flag to automatically copy from the source RESFK_ records to the working set RESCP_ records
119
- # during initial fresh database creation.
120
- DEFAULT_DB_POPULATE=true
121
- # Default flag to automatically populate the redis cache (if enabled) with the current RESCP_ records
122
- # as they are being created. Only valid when DEFAULT_DB_POPULATE = true AND USE_REDIS = true.
123
- DEFAULT_REDIS_POPULATE=true
124
- # Default number of entries K6 should test against.
125
- DEFAULT_K6_ENTRIES=10000
126
- # Default microservice end-point for K6 tests.
127
- DEFAULT_K6_MS_HOST=localhost
128
- # Default microservice port for K6 tests.
129
- DEFAULT_K6_MS_PORT=3000
130
- # Default ratio (%) that each test should be an update rather than just a read.
131
- DEFAULT_K6_UPDATE_RATIO=2
132
- # Default ratio (%) that for an update, this update will actually be a delete. Only valid when
133
- # DEFAULT_K6_UPDATE_RATIO is > 0
134
- DEFAULT_K6_DELETE_RATIO=0
135
- # Default flag to always create a new record for each interation during K6 test runs. The new
136
- # record will contain a UUID for the ID to ensure uniqueness.
137
- DEFAULT_K6_ALWAYS_ADD=false
138
- # Default number of virtual CPUs to use on each testing node.
139
- DEFAULT_K6_VCPU=20
140
- # Default duration each test node should run the K6 test.
141
- DEFAULT_K6_DURATION=30s
142
- # ==================================================================================================
143
- # Production Settings
144
- # ==================================================================================================
145
- #PORT=3000
146
- #NODE_ENV=production
147
- #DATABASE_URL=postgresql://postgres:02740274@192.168.0.160:5432/testdb
148
- #REDIS_SERVER=192.168.0.160
149
- #REDIS_PORT=6379
150
- #USE_REDIS=true
151
- #REDIS_END_FLUSH=false
152
- #CONSOLE_LOG_ERRORS=false
153
- #
154
- # Only use for self signed certificates, otherwise remove from .env file
155
- #NODE_TLS_REJECT_UNAUTHORIZED=0
156
- #
157
- # To run PROD from command line
158
- # PORT=3000 NODE_ENV=production DATABASE_URL='postgresql://postgres:02740274@192.168.0.27:5432/testdb' node app
159
- #
160
- # To run DEV from command line
161
- # PORT=3000 NODE_ENV=debug DB_USER=postgres DB_PASSWORD=02740274 DB_HOST=192.168.0.27 DB_PORT=5432 DB_DATABASE=testdb node app
162
-
163
- MONITOR = false
164
- TRANSPORT = RESTAPI
165
-
166
- #MONITOR = true
167
- #TRANSPORT = RESTAPI
83
+ PUBLISH_INTERVAL=10000
84
+ PUBLISH_TIMEOUT=7500
85
+ PUBLISH_DEBUG=true
86
+ TRANSPORT=RESTAPI-c
87
+ USE_SECURE_COOKIES=true
88
+ KEEP_ALIVE=false
89
+ MAX_SOCKETS=100
90
+ MAX_TOTAL_SOCKETS=200
91
+ MAX_FREE_SOCKETS=2560
92
+ TIMEOUT=100000
93
+ MAX_PAYLOAD_SIZE=50mb-c
94
+ INSTRUMENTATION_OBSERVATION_INTERVAL=10000
95
+ INSTRUMENTATION_TIME_WINDOW=6000
96
+ AUTH_JWT_ACCESS_TOKEN_TIMEOUT=6000
97
+ AUTH_JWT_REFRESH_TOKEN_TIMEOUT=864000
98
+ AUTH_COOKIE_TIMEOUT=864000
99
+ MASTER_PROCESS_EXIT_TIME=5000
100
+ CHILD_PROCESS_EXIT_TIME=5000
101
+ SYSTEM_INFORMATION_INTERVAL=10000
102
+ IGNORE_SOCKETIO=false
103
+ MODEL_PURGE_UPDATE_TIMEOUT=50000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsconfig",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "description": "",
5
5
  "main": "stsconfig.js",
6
6
  "dependencies": {
@@ -0,0 +1,173 @@
1
+
2
+ describe("Test implicit config settings", () =>
3
+ {
4
+ beforeAll(async () =>
5
+ {
6
+
7
+ });
8
+
9
+ afterAll(async () =>
10
+ {
11
+
12
+ });
13
+
14
+ test('Checking default config items', async () =>
15
+ {
16
+ expect.assertions(22);
17
+
18
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
19
+ let goptions = require('./stsconfig.js').$options;
20
+
21
+ expect(goptions.isProduction).toEqual(false);
22
+ expect(goptions.isTest).toEqual(true);
23
+ expect(goptions.consoleLogErrors).toEqual(false);
24
+ expect(goptions.dbuser).toEqual('postgres');
25
+ expect(goptions.dbpassword).toEqual('password');
26
+ expect(goptions.dbpasswordfile).toEqual(undefined);
27
+ expect(goptions.dbhost).toEqual('localhost');
28
+ expect(goptions.dbport).toEqual('5432');
29
+ expect(goptions.database).toEqual('stsrestmsdb01');
30
+ expect(goptions.databaseUrl).toEqual(undefined);
31
+ expect(goptions.databasescriptfolder).toEqual('/var/lib/sts/stsglobalresources/db-scripts');
32
+
33
+ expect(goptions.poolSize).toEqual(500);
34
+ expect(goptions.useCPUs).toEqual(-1);
35
+ expect(goptions.respawnOnFail).toEqual(false);
36
+ expect(goptions.defaultDatabaseEntries).toEqual(10000);
37
+ expect(goptions.useRedis).toEqual(false);
38
+ expect(goptions.endFlush).toEqual(false);
39
+ expect(goptions.redisPort).toEqual('6379');
40
+ expect(goptions.redisServer).toEqual('localhost');
41
+ expect(goptions.k6ScriptPath).toEqual('.');
42
+ expect(goptions.defaultDatabaseMinExtraDataSize).toEqual(0);
43
+ expect(goptions.defaultDatabaseMaxExtraDataSize).toEqual(2000);
44
+ });
45
+
46
+ test('Checking default rest01 service config', async () =>
47
+ {
48
+ expect.assertions(11);
49
+
50
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
51
+ let goptions = require('./stsconfig.js').$options;
52
+
53
+ expect(goptions.rest01endpoint).toEqual('http://localhost');
54
+ expect(goptions.rest01hostport).toEqual('3003');
55
+ expect(goptions.rest01port).toEqual('3003');
56
+ expect(goptions.rest01apiroot).toEqual('/stsrest01/v1');
57
+ expect(goptions.rest01prometheussupport).toEqual(true);
58
+ expect(goptions.rest01prometheusclusterport).toEqual('3013');
59
+ expect(goptions.rest01servicename).toEqual('STSRest01');
60
+ expect(goptions.rest01serviceversion).toEqual('1.0.0');
61
+ expect(goptions.rest01email).toEqual('STSREST01ServiceUser@stsmda.com');
62
+ expect(goptions.rest01password).toEqual('STSREST01ServiceUserPassword');
63
+ expect(goptions.rest01passwordfile).toEqual(undefined);
64
+ });
65
+
66
+ test('Checking default instrument manager service config', async () =>
67
+ {
68
+ expect.assertions(11);
69
+
70
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
71
+ let goptions = require('./stsconfig.js').$options;
72
+
73
+ expect(goptions.imendpoint).toEqual('http://localhost');
74
+ expect(goptions.imhostport).toEqual('3001');
75
+ expect(goptions.import).toEqual('3001');
76
+ expect(goptions.imapiroot).toEqual('/stsinstrumentmanager/v1');
77
+ expect(goptions.imprometheussupport).toEqual(true);
78
+ expect(goptions.imprometheusclusterport).toEqual('3011');
79
+ expect(goptions.imservicename).toEqual('STSInstrumentManager');
80
+ expect(goptions.imserviceversion).toEqual('1.0.0');
81
+ expect(goptions.imemail).toEqual('STSInstrumentManagerServiceUser@stsmda.com');
82
+ expect(goptions.impassword).toEqual('STSInstrumentManagerServiceUserPassword');
83
+ expect(goptions.impasswordfile).toEqual(undefined);
84
+ });
85
+
86
+ test('Checking default test orchestrator service config', async () =>
87
+ {
88
+ expect.assertions(11);
89
+
90
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
91
+ let goptions = require('./stsconfig.js').$options;
92
+
93
+ expect(goptions.toendpoint).toEqual('http://localhost');
94
+ expect(goptions.tohostport).toEqual('3004');
95
+ expect(goptions.toport).toEqual('3004');
96
+ expect(goptions.toapiroot).toEqual('/ststestorchestrator/v1');
97
+ expect(goptions.toprometheussupport).toEqual(true);
98
+ expect(goptions.toprometheusclusterport).toEqual('3014');
99
+ expect(goptions.toservicename).toEqual('STSTestOrchestrator');
100
+ expect(goptions.toserviceversion).toEqual('1.0.0');
101
+ expect(goptions.toemail).toEqual('STSTestOrchestratorServiceUser@stsmda.com');
102
+ expect(goptions.topassword).toEqual('STSTestOrchestratorServiceUserPassword');
103
+ expect(goptions.topasswordfile).toEqual(undefined);
104
+ });
105
+
106
+ test('Checking default authentication service config', async () =>
107
+ {
108
+ expect.assertions(13);
109
+
110
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
111
+ let goptions = require('./stsconfig.js').$options;
112
+
113
+ expect(goptions.asendpoint).toEqual('http://localhost');
114
+ expect(goptions.ashostport).toEqual('3002');
115
+ expect(goptions.asport).toEqual('3002');
116
+ expect(goptions.asapiroot).toEqual('/stsauth/v1');
117
+ expect(goptions.asprometheussupport).toEqual(true);
118
+ expect(goptions.asprometheusclusterport).toEqual('3012');
119
+ expect(goptions.asservicename).toEqual('STSAuth');
120
+ expect(goptions.asserviceversion).toEqual('1.0.0');
121
+ expect(goptions.asemail).toEqual('STSAuthServiceUser@stsmda.com');
122
+ expect(goptions.aspassword).toEqual('STSAuthServiceUserPassword');
123
+ expect(goptions.aspasswordfile).toEqual(undefined);
124
+ expect(goptions.asprivatekeypath).toEqual('/var/lib/sts/stsglobalresources/keys/private.key');
125
+ expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key');
126
+ });
127
+
128
+ test('Checking default test runner service config', async () =>
129
+ {
130
+ expect.assertions(7);
131
+
132
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
133
+ let goptions = require('./stsconfig.js').$options;
134
+
135
+ expect(goptions.trprometheussupport).toEqual(true);
136
+ expect(goptions.trprometheusclusterport).toEqual('3015');
137
+ expect(goptions.trservicename).toEqual('STSRestRunner');
138
+ expect(goptions.trserviceversion).toEqual('1.0.0');
139
+ expect(goptions.tremail).toEqual('STSTestRunnerServiceUser@stsmda.com');
140
+ expect(goptions.trpassword).toEqual('STSTestRunnerServiceUserPassword');
141
+ expect(goptions.trpasswordfile).toEqual(undefined);
142
+ });
143
+
144
+ test('Checking default additional config items', async () =>
145
+ {
146
+ expect.assertions(20);
147
+
148
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
149
+ let goptions = require('./stsconfig.js').$options;
150
+
151
+ expect(goptions.publishinterval).toEqual(1000);
152
+ expect(goptions.publishtimeout).toEqual(750);
153
+ expect(goptions.publishdebug).toEqual(false);
154
+ expect(goptions.transport).toEqual('RESTAPI');
155
+ expect(goptions.useSecureCookies).toEqual(false);
156
+ expect(goptions.keepAlive).toEqual(true);
157
+ expect(goptions.maxSockets).toEqual(10);
158
+ expect(goptions.maxTotalSockets).toEqual(20);
159
+ expect(goptions.maxFreeSockets).toEqual(256);
160
+ expect(goptions.timeout).toEqual(10000);
161
+ expect(goptions.maxPayloadSize).toEqual('50mb');
162
+ expect(goptions.instrumentationObservationInterval).toEqual(1000);
163
+ expect(goptions.instrumentationTimeWindow).toEqual(600);
164
+ expect(goptions.authJWTAccessTokenTimeout).toEqual(600);
165
+ expect(goptions.authJWTRefreshTokenTimeout).toEqual(3600 * 24);
166
+ expect(goptions.authCookieTimeout).toEqual(3600 * 24);
167
+ expect(goptions.masterProcessExitTime).toEqual(500);
168
+ expect(goptions.childProcessExitTime).toEqual(500);
169
+ expect(goptions.systemInformationInterval).toEqual(1000);
170
+ expect(goptions.ignoresocketio).toEqual(true);
171
+ });
172
+ });
173
+
@@ -0,0 +1,173 @@
1
+
2
+ describe("Test configured settings", () =>
3
+ {
4
+ beforeAll(async () =>
5
+ {
6
+
7
+ });
8
+
9
+ afterAll(async () =>
10
+ {
11
+
12
+ });
13
+
14
+ test('Checking default config items', async () =>
15
+ {
16
+ expect.assertions(22);
17
+
18
+ process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
19
+ let goptions = require('./stsconfig.js').$options;
20
+
21
+ expect(goptions.isProduction).toEqual(false);
22
+ expect(goptions.isTest).toEqual(true);
23
+ expect(goptions.consoleLogErrors).toEqual(true);
24
+ expect(goptions.dbuser).toEqual('postgres-c');
25
+ expect(goptions.dbpassword).toEqual('testfilepassword');
26
+ expect(goptions.dbpasswordfile).toEqual('testpasswordfile');
27
+ expect(goptions.dbhost).toEqual('localhost-c');
28
+ expect(goptions.dbport).toEqual('54320');
29
+ expect(goptions.database).toEqual('stsrestmsdb01-c');
30
+ expect(goptions.databaseUrl).toEqual('-c');
31
+ expect(goptions.databasescriptfolder).toEqual('/var/lib/sts/stsglobalresources/db-scripts-c');
32
+
33
+ expect(goptions.poolSize).toEqual(5000);
34
+ expect(goptions.useCPUs).toEqual(-10);
35
+ expect(goptions.respawnOnFail).toEqual(true);
36
+ expect(goptions.defaultDatabaseEntries).toEqual(100000);
37
+ expect(goptions.useRedis).toEqual(true);
38
+ expect(goptions.endFlush).toEqual(true);
39
+ expect(goptions.redisPort).toEqual('63790');
40
+ expect(goptions.redisServer).toEqual('localhost-c');
41
+ expect(goptions.k6ScriptPath).toEqual('.-c');
42
+ expect(goptions.defaultDatabaseMinExtraDataSize).toEqual(1);
43
+ expect(goptions.defaultDatabaseMaxExtraDataSize).toEqual(20000);
44
+ });
45
+
46
+ test('Checking default rest01 service config', async () =>
47
+ {
48
+ expect.assertions(11);
49
+
50
+ process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
51
+ let goptions = require('./stsconfig.js').$options;
52
+
53
+ expect(goptions.rest01endpoint).toEqual('http://localhost-c');
54
+ expect(goptions.rest01hostport).toEqual('30030');
55
+ expect(goptions.rest01port).toEqual('30030');
56
+ expect(goptions.rest01apiroot).toEqual('/stsrest01/v1-c');
57
+ expect(goptions.rest01prometheussupport).toEqual(false);
58
+ expect(goptions.rest01prometheusclusterport).toEqual('30130');
59
+ expect(goptions.rest01servicename).toEqual('STSRest01-c');
60
+ expect(goptions.rest01serviceversion).toEqual('1.0.0-c');
61
+ expect(goptions.rest01email).toEqual('K6TestUser@sts-c');
62
+ expect(goptions.rest01password).toEqual('testfilepassword');
63
+ expect(goptions.rest01passwordfile).toEqual('testpasswordfile');
64
+ });
65
+
66
+ test('Checking default instrument manager service config', async () =>
67
+ {
68
+ expect.assertions(11);
69
+
70
+ process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
71
+ let goptions = require('./stsconfig.js').$options;
72
+
73
+ expect(goptions.imendpoint).toEqual('http://localhost-c');
74
+ expect(goptions.imhostport).toEqual('30010');
75
+ expect(goptions.import).toEqual('30010');
76
+ expect(goptions.imapiroot).toEqual('/stsinstrumentmanager/v1-c');
77
+ expect(goptions.imprometheussupport).toEqual(false);
78
+ expect(goptions.imprometheusclusterport).toEqual('30110');
79
+ expect(goptions.imservicename).toEqual('STSInstrumentManager-c');
80
+ expect(goptions.imserviceversion).toEqual('1.0.0-c');
81
+ expect(goptions.imemail).toEqual('K6TestUser@sts-c');
82
+ expect(goptions.impassword).toEqual('testfilepassword');
83
+ expect(goptions.impasswordfile).toEqual('testpasswordfile');
84
+ });
85
+
86
+ test('Checking default test orchestrator service config', async () =>
87
+ {
88
+ expect.assertions(11);
89
+
90
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
91
+ let goptions = require('./stsconfig.js').$options;
92
+
93
+ expect(goptions.toendpoint).toEqual('http://localhost-c');
94
+ expect(goptions.tohostport).toEqual('30040');
95
+ expect(goptions.toport).toEqual('30040');
96
+ expect(goptions.toapiroot).toEqual('/ststestorchestrator/v1-c');
97
+ expect(goptions.toprometheussupport).toEqual(false);
98
+ expect(goptions.toprometheusclusterport).toEqual('30140');
99
+ expect(goptions.toservicename).toEqual('STSTestOrchestrator-c');
100
+ expect(goptions.toserviceversion).toEqual('1.0.0-c');
101
+ expect(goptions.toemail).toEqual('K6TestUser@sts-c');
102
+ expect(goptions.topassword).toEqual('testfilepassword');
103
+ expect(goptions.topasswordfile).toEqual('testpasswordfile');
104
+ });
105
+
106
+ test('Checking default authentication service config', async () =>
107
+ {
108
+ expect.assertions(13);
109
+
110
+ process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
111
+ let goptions = require('./stsconfig.js').$options;
112
+
113
+ expect(goptions.asendpoint).toEqual('http://localhost-c');
114
+ expect(goptions.ashostport).toEqual('30020');
115
+ expect(goptions.asport).toEqual('30020');
116
+ expect(goptions.asapiroot).toEqual('/stsauth/v1-c');
117
+ expect(goptions.asprometheussupport).toEqual(false);
118
+ expect(goptions.asprometheusclusterport).toEqual('30120');
119
+ expect(goptions.asservicename).toEqual('STSAuth-c');
120
+ expect(goptions.asserviceversion).toEqual('1.0.0-c');
121
+ expect(goptions.asemail).toEqual('K6TestUser@sts-c');
122
+ expect(goptions.aspassword).toEqual('testfilepassword');
123
+ expect(goptions.aspasswordfile).toEqual('testpasswordfile');
124
+ expect(goptions.asprivatekeypath).toEqual('/var/lib/sts/stsglobalresources/keys/private.key-c');
125
+ expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key-c');
126
+ });
127
+
128
+ test('Checking default test runner service config', async () =>
129
+ {
130
+ expect.assertions(7);
131
+
132
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
133
+ let goptions = require('./stsconfig.js').$options;
134
+
135
+ expect(goptions.trprometheussupport).toEqual(false);
136
+ expect(goptions.trprometheusclusterport).toEqual('30150');
137
+ expect(goptions.trservicename).toEqual('STSRestRunner-c');
138
+ expect(goptions.trserviceversion).toEqual('1.0.0-c');
139
+ expect(goptions.tremail).toEqual('K6TestUser@sts-c');
140
+ expect(goptions.trpassword).toEqual('testfilepassword');
141
+ expect(goptions.trpasswordfile).toEqual('testpasswordfile');
142
+ });
143
+
144
+ test('Checking default additional config items', async () =>
145
+ {
146
+ expect.assertions(20);
147
+
148
+ process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
149
+ let goptions = require('./stsconfig.js').$options;
150
+
151
+ expect(goptions.publishinterval).toEqual(10000);
152
+ expect(goptions.publishtimeout).toEqual(7500);
153
+ expect(goptions.publishdebug).toEqual(true);
154
+ expect(goptions.transport).toEqual('RESTAPI-c');
155
+ expect(goptions.useSecureCookies).toEqual(true);
156
+ expect(goptions.keepAlive).toEqual(false);
157
+ expect(goptions.maxSockets).toEqual(100);
158
+ expect(goptions.maxTotalSockets).toEqual(200);
159
+ expect(goptions.maxFreeSockets).toEqual(2560);
160
+ expect(goptions.timeout).toEqual(100000);
161
+ expect(goptions.maxPayloadSize).toEqual('50mb-c');
162
+ expect(goptions.instrumentationObservationInterval).toEqual(10000);
163
+ expect(goptions.instrumentationTimeWindow).toEqual(6000);
164
+ expect(goptions.authJWTAccessTokenTimeout).toEqual(6000);
165
+ expect(goptions.authJWTRefreshTokenTimeout).toEqual(3600 * 24 * 10);
166
+ expect(goptions.authCookieTimeout).toEqual(3600 * 24 * 10);
167
+ expect(goptions.masterProcessExitTime).toEqual(5000);
168
+ expect(goptions.childProcessExitTime).toEqual(5000);
169
+ expect(goptions.systemInformationInterval).toEqual(10000);
170
+ expect(goptions.ignoresocketio).toEqual(false);
171
+ });
172
+ });
173
+
@@ -0,0 +1,173 @@
1
+
2
+ describe("Test explicit default config settings", () =>
3
+ {
4
+ beforeAll(async () =>
5
+ {
6
+
7
+ });
8
+
9
+ afterAll(async () =>
10
+ {
11
+
12
+ });
13
+
14
+ test('Checking default config items', async () =>
15
+ {
16
+ expect.assertions(22);
17
+
18
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
19
+ let goptions = require('./stsconfig.js').$options;
20
+
21
+ expect(goptions.isProduction).toEqual(false);
22
+ expect(goptions.isTest).toEqual(true);
23
+ expect(goptions.consoleLogErrors).toEqual(false);
24
+ expect(goptions.dbuser).toEqual('postgres');
25
+ expect(goptions.dbpassword).toEqual('password');
26
+ expect(goptions.dbpasswordfile).toEqual(undefined);
27
+ expect(goptions.dbhost).toEqual('localhost');
28
+ expect(goptions.dbport).toEqual('5432');
29
+ expect(goptions.database).toEqual('stsrestmsdb01');
30
+ expect(goptions.databaseUrl).toEqual(undefined);
31
+ expect(goptions.databasescriptfolder).toEqual('/var/lib/sts/stsglobalresources/db-scripts');
32
+
33
+ expect(goptions.poolSize).toEqual(500);
34
+ expect(goptions.useCPUs).toEqual(-1);
35
+ expect(goptions.respawnOnFail).toEqual(false);
36
+ expect(goptions.defaultDatabaseEntries).toEqual(10000);
37
+ expect(goptions.useRedis).toEqual(false);
38
+ expect(goptions.endFlush).toEqual(false);
39
+ expect(goptions.redisPort).toEqual('6379');
40
+ expect(goptions.redisServer).toEqual('localhost');
41
+ expect(goptions.k6ScriptPath).toEqual('.');
42
+ expect(goptions.defaultDatabaseMinExtraDataSize).toEqual(0);
43
+ expect(goptions.defaultDatabaseMaxExtraDataSize).toEqual(2000);
44
+ });
45
+
46
+ test('Checking default rest01 service config', async () =>
47
+ {
48
+ expect.assertions(11);
49
+
50
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
51
+ let goptions = require('./stsconfig.js').$options;
52
+
53
+ expect(goptions.rest01endpoint).toEqual('http://localhost');
54
+ expect(goptions.rest01hostport).toEqual('3003');
55
+ expect(goptions.rest01port).toEqual('3003');
56
+ expect(goptions.rest01apiroot).toEqual('/stsrest01/v1');
57
+ expect(goptions.rest01prometheussupport).toEqual(true);
58
+ expect(goptions.rest01prometheusclusterport).toEqual('3013');
59
+ expect(goptions.rest01servicename).toEqual('STSRest01');
60
+ expect(goptions.rest01serviceversion).toEqual('1.0.0');
61
+ expect(goptions.rest01email).toEqual('STSREST01ServiceUser@stsmda.com');
62
+ expect(goptions.rest01password).toEqual('STSREST01ServiceUserPassword');
63
+ expect(goptions.rest01passwordfile).toEqual(undefined);
64
+ });
65
+
66
+ test('Checking default instrument manager service config', async () =>
67
+ {
68
+ expect.assertions(11);
69
+
70
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
71
+ let goptions = require('./stsconfig.js').$options;
72
+
73
+ expect(goptions.imendpoint).toEqual('http://localhost');
74
+ expect(goptions.imhostport).toEqual('3001');
75
+ expect(goptions.import).toEqual('3001');
76
+ expect(goptions.imapiroot).toEqual('/stsinstrumentmanager/v1');
77
+ expect(goptions.imprometheussupport).toEqual(true);
78
+ expect(goptions.imprometheusclusterport).toEqual('3011');
79
+ expect(goptions.imservicename).toEqual('STSInstrumentManager');
80
+ expect(goptions.imserviceversion).toEqual('1.0.0');
81
+ expect(goptions.imemail).toEqual('STSInstrumentManagerServiceUser@stsmda.com');
82
+ expect(goptions.impassword).toEqual('STSInstrumentManagerServiceUserPassword');
83
+ expect(goptions.impasswordfile).toEqual(undefined);
84
+ });
85
+
86
+ test('Checking default test orchestrator service config', async () =>
87
+ {
88
+ expect.assertions(11);
89
+
90
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
91
+ let goptions = require('./stsconfig.js').$options;
92
+
93
+ expect(goptions.toendpoint).toEqual('http://localhost');
94
+ expect(goptions.tohostport).toEqual('3004');
95
+ expect(goptions.toport).toEqual('3004');
96
+ expect(goptions.toapiroot).toEqual('/ststestorchestrator/v1');
97
+ expect(goptions.toprometheussupport).toEqual(true);
98
+ expect(goptions.toprometheusclusterport).toEqual('3014');
99
+ expect(goptions.toservicename).toEqual('STSTestOrchestrator');
100
+ expect(goptions.toserviceversion).toEqual('1.0.0');
101
+ expect(goptions.toemail).toEqual('STSTestOrchestratorServiceUser@stsmda.com');
102
+ expect(goptions.topassword).toEqual('STSTestOrchestratorServiceUserPassword');
103
+ expect(goptions.topasswordfile).toEqual(undefined);
104
+ });
105
+
106
+ test('Checking default authentication service config', async () =>
107
+ {
108
+ expect.assertions(13);
109
+
110
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
111
+ let goptions = require('./stsconfig.js').$options;
112
+
113
+ expect(goptions.asendpoint).toEqual('http://localhost');
114
+ expect(goptions.ashostport).toEqual('3002');
115
+ expect(goptions.asport).toEqual('3002');
116
+ expect(goptions.asapiroot).toEqual('/stsauth/v1');
117
+ expect(goptions.asprometheussupport).toEqual(true);
118
+ expect(goptions.asprometheusclusterport).toEqual('3012');
119
+ expect(goptions.asservicename).toEqual('STSAuth');
120
+ expect(goptions.asserviceversion).toEqual('1.0.0');
121
+ expect(goptions.asemail).toEqual('STSAuthServiceUser@stsmda.com');
122
+ expect(goptions.aspassword).toEqual('STSAuthServiceUserPassword');
123
+ expect(goptions.aspasswordfile).toEqual(undefined);
124
+ expect(goptions.asprivatekeypath).toEqual('/var/lib/sts/stsglobalresources/keys/private.key');
125
+ expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key');
126
+ });
127
+
128
+ test('Checking default test runner service config', async () =>
129
+ {
130
+ expect.assertions(7);
131
+
132
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
133
+ let goptions = require('./stsconfig.js').$options;
134
+
135
+ expect(goptions.trprometheussupport).toEqual(true);
136
+ expect(goptions.trprometheusclusterport).toEqual('3015');
137
+ expect(goptions.trservicename).toEqual('STSRestRunner');
138
+ expect(goptions.trserviceversion).toEqual('1.0.0');
139
+ expect(goptions.tremail).toEqual('STSTestRunnerServiceUser@stsmda.com');
140
+ expect(goptions.trpassword).toEqual('STSTestRunnerServiceUserPassword');
141
+ expect(goptions.trpasswordfile).toEqual(undefined);
142
+ });
143
+
144
+ test('Checking default additional config items', async () =>
145
+ {
146
+ expect.assertions(20);
147
+
148
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
149
+ let goptions = require('./stsconfig.js').$options;
150
+
151
+ expect(goptions.publishinterval).toEqual(1000);
152
+ expect(goptions.publishtimeout).toEqual(750);
153
+ expect(goptions.publishdebug).toEqual(false);
154
+ expect(goptions.transport).toEqual('RESTAPI');
155
+ expect(goptions.useSecureCookies).toEqual(false);
156
+ expect(goptions.keepAlive).toEqual(true);
157
+ expect(goptions.maxSockets).toEqual(10);
158
+ expect(goptions.maxTotalSockets).toEqual(20);
159
+ expect(goptions.maxFreeSockets).toEqual(256);
160
+ expect(goptions.timeout).toEqual(10000);
161
+ expect(goptions.maxPayloadSize).toEqual('50mb');
162
+ expect(goptions.instrumentationObservationInterval).toEqual(1000);
163
+ expect(goptions.instrumentationTimeWindow).toEqual(600);
164
+ expect(goptions.authJWTAccessTokenTimeout).toEqual(600);
165
+ expect(goptions.authJWTRefreshTokenTimeout).toEqual(3600 * 24);
166
+ expect(goptions.authCookieTimeout).toEqual(3600 * 24);
167
+ expect(goptions.masterProcessExitTime).toEqual(500);
168
+ expect(goptions.childProcessExitTime).toEqual(500);
169
+ expect(goptions.systemInformationInterval).toEqual(1000);
170
+ expect(goptions.ignoresocketio).toEqual(true);
171
+ });
172
+ });
173
+
package/stsconfig.js CHANGED
@@ -16,7 +16,9 @@ require('dotenv').config({ path: envfile });
16
16
  const defconfig =
17
17
  {
18
18
  // Node runtime environment
19
- isProduction: (process.env.NODE_ENV === undefined ? false : process.env.NODE_ENV === 'production')
19
+ isProduction: (process.env.NODE_ENV === undefined ? false : (process.env.NODE_ENV === 'production' ? true : false))
20
+ // Node runtime environment
21
+ ,isTest: (process.env.NODE_ENV === undefined ? false : (process.env.NODE_ENV === 'test' ? true : false))
20
22
  // Log error messages to the console within the microservice
21
23
  ,consoleLogErrors: (process.env.CONSOLE_LOG_ERRORS === undefined ? false : (process.env.CONSOLE_LOG_ERRORS === "true" ? true : false ))
22
24
  // Database username.
@@ -44,7 +46,7 @@ const defconfig =
44
46
  // Automatically re-spawn a worker thread if one dies.
45
47
  ,respawnOnFail: (process.env.RESPAWN === undefined ? false : (process.env.RESPAWN === "true" ? true : false ))
46
48
  // Default number of entries to create for a fresh database.
47
- ,defaultDatabaseEntries: (process.env.DEFAULT_DB_ENTRIES === undefined ? 10000 : process.env.DEFAULT_DB_ENTRIES)
49
+ ,defaultDatabaseEntries: (process.env.DEFAULT_DB_ENTRIES === undefined ? 10000 : parseInt(process.env.DEFAULT_DB_ENTRIES))
48
50
  // Microservice listen port.
49
51
  ,useRedis: (process.env.USE_REDIS === undefined ? false : (process.env.USE_REDIS === "true" ? true : false ))
50
52
  // Use redis for Microservice.
@@ -81,9 +83,9 @@ const defconfig =
81
83
  // STSREST01 Service Credentials
82
84
  // -----------------------------
83
85
  // STSREST01 Server username email
84
- ,rest01email: (process.env.REST01_EMAIL === undefined ? "K6TestUser@sts" : process.env.REST01_EMAIL)
86
+ ,rest01email: (process.env.REST01_EMAIL === undefined ? "STSREST01ServiceUser@stsmda.com" : process.env.REST01_EMAIL)
85
87
  // STSREST01 Server username password
86
- ,rest01password: (process.env.REST01_PASSWORD === undefined ? "K6TestUserPassword" : process.env.REST01_PASSWORD)
88
+ ,rest01password: (process.env.REST01_PASSWORD === undefined ? "STSREST01ServiceUserPassword" : process.env.REST01_PASSWORD)
87
89
  // STSREST01 Server username password file
88
90
  ,rest01passwordfile: process.env.REST01_PASSWORD_FILE
89
91
 
@@ -106,9 +108,9 @@ const defconfig =
106
108
  // STS Instrument Manager Service Credentials
107
109
  // ------------------------------------------
108
110
  // STS Instrument Manager Service username email
109
- ,imemail: (process.env.IM_EMAIL === undefined ? "K6TestUser@sts" : process.env.IM_EMAIL)
111
+ ,imemail: (process.env.IM_EMAIL === undefined ? "STSInstrumentManagerServiceUser@stsmda.com" : process.env.IM_EMAIL)
110
112
  // STS Instrument Manager Service username password
111
- ,impassword: (process.env.IM_PASSWORD === undefined ? "K6TestUserPassword" : process.env.IM_PASSWORD)
113
+ ,impassword: (process.env.IM_PASSWORD === undefined ? "STSInstrumentManagerServiceUserPassword" : process.env.IM_PASSWORD)
112
114
  // STS Instrument Manager Service username password file
113
115
  ,impasswordfile: process.env.IM_PASSWORD_FILE
114
116
 
@@ -131,9 +133,9 @@ const defconfig =
131
133
  // STS Test Orchestrator Service Credentials
132
134
  // ------------------------------------------
133
135
  // STS Test Orchestrator Service username email
134
- ,toemail: (process.env.TO_EMAIL === undefined ? "K6TestUser@sts" : process.env.TO_EMAIL)
136
+ ,toemail: (process.env.TO_EMAIL === undefined ? "STSTestOrchestratorServiceUser@stsmda.com" : process.env.TO_EMAIL)
135
137
  // STS Test Orchestrator Service username password
136
- ,topassword: (process.env.TO_PASSWORD === undefined ? "K6TestUserPassword" : process.env.TO_PASSWORD)
138
+ ,topassword: (process.env.TO_PASSWORD === undefined ? "STSTestOrchestratorServiceUserPassword" : process.env.TO_PASSWORD)
137
139
  // STS Test Orchestrator Service username password file
138
140
  ,topasswordfile: process.env.TO_PASSWORD_FILE
139
141
 
@@ -156,9 +158,9 @@ const defconfig =
156
158
  // STS Auth Service Credentials
157
159
  // ----------------------------
158
160
  // Auth Server username email
159
- ,asemail: (process.env.AS_EMAIL === undefined ? "K6TestUser@sts" : process.env.AS_EMAIL)
161
+ ,asemail: (process.env.AS_EMAIL === undefined ? "STSAuthServiceUser@stsmda.com" : process.env.AS_EMAIL)
160
162
  // Auth Server username password
161
- ,aspassword: (process.env.AS_PASSWORD === undefined ? "K6TestUserPassword" : process.env.AS_PASSWORD)
163
+ ,aspassword: (process.env.AS_PASSWORD === undefined ? "STSAuthServiceUserPassword" : process.env.AS_PASSWORD)
162
164
  // Auth Server username password file
163
165
  ,aspasswordfile: process.env.AS_PASSWORD_FILE
164
166
  // Auth Server - Private Key (when using JWT)
@@ -177,9 +179,9 @@ const defconfig =
177
179
  // STS Test Runner Credentials
178
180
  // ----------------------------
179
181
  // STS Test Runner username email
180
- ,tremail: (process.env.TR_EMAIL === undefined ? "K6TestUser@sts" : process.env.TR_EMAIL)
182
+ ,tremail: (process.env.TR_EMAIL === undefined ? "STSTestRunnerServiceUser@stsmda.com" : process.env.TR_EMAIL)
181
183
  // STS Test Runner password
182
- ,trpassword: (process.env.TR_PASSWORD === undefined ? "K6TestUserPassword" : process.env.TR_PASSWORD)
184
+ ,trpassword: (process.env.TR_PASSWORD === undefined ? "STSTestRunnerServiceUserPassword" : process.env.TR_PASSWORD)
183
185
  // STS Test Runner password file
184
186
  ,trpasswordfile: process.env.TR_PASSWORD_FILE
185
187
 
@@ -194,7 +196,7 @@ const defconfig =
194
196
  ,publishdebug: (process.env.PUBLISH_DEBUG === undefined ? false : (process.env.PUBLISH_DEBUG === "true" ? true : false ))
195
197
 
196
198
  // Transport(s) to use for sending instrumentation data to the instrumentation server
197
- ,transport: (process.env.TRANSPORT === undefined ? 0 : process.env.TRANSPORT)
199
+ ,transport: (process.env.TRANSPORT === undefined ? 'RESTAPI' : process.env.TRANSPORT)
198
200
 
199
201
  /*
200
202
  // Instrument Defaults
@@ -215,31 +217,31 @@ const defconfig =
215
217
  // This setting will be ignore for production mode. In production mode services will always use secure cookies.
216
218
  ,useSecureCookies: (process.env.USE_SECURE_COOKIES === undefined ? false : (process.env.USE_SECURE_COOKIES === "true" ? true : false ))
217
219
 
218
- ,keepAlive: (process.env.KEEP_ALIVE === undefined ? true : (process.env.KEEP_ALIVE === "true" ? true : false ))
219
- // Reference: https://nodejs.org/api/http.html#class-httpagent
220
220
  // keepAlive <boolean> Keep sockets around even when there are no outstanding requests, so they can be used for future requests without having to reestablish a
221
221
  // TCP connection. Not to be confused with the keep-alive value of the Connection header. The Connection: keep-alive header is always sent when using an agent
222
222
  // except when the Connection header is explicitly specified or when the keepAlive and maxSockets options are respectively set to false and Infinity, in which
223
223
  // case Connection: close will be used. Default: false.
224
-
225
- ,maxSockets: (process.env.MAX_SOCKETS === undefined ? 10 : parseInt(process.env.MAX_SOCKETS))
226
224
  // Reference: https://nodejs.org/api/http.html#class-httpagent
225
+ ,keepAlive: (process.env.KEEP_ALIVE === undefined ? true : (process.env.KEEP_ALIVE === "true" ? true : false ))
226
+
227
227
  // maxSockets <number> Maximum number of sockets to allow per host. If the same host opens multiple concurrent connections, each request will use new socket until the
228
228
  // maxSockets value is reached. If the host attempts to open more connections than maxSockets, the additional requests will enter into a pending request queue, and will
229
229
  // enter active connection state when an existing connection terminates. This makes sure there are at most maxSockets active connections at any point in time,
230
230
  // from a given host. Default: Infinity.
231
-
232
- ,maxTotalSockets: (process.env.MAX_TOTAL_SOCKETS === undefined ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS))
233
231
  // Reference: https://nodejs.org/api/http.html#class-httpagent
234
- // maxTotalSockets <number> Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
232
+ ,maxSockets: (process.env.MAX_SOCKETS === undefined ? 10 : parseInt(process.env.MAX_SOCKETS))
235
233
 
236
- ,maxFreeSockets: (process.env.MAX_FREE_SOCKETS === undefined ? 256 : parseInt(process.env.MAX_FREE_SOCKETS))
234
+ // maxTotalSockets <number> Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
237
235
  // Reference: https://nodejs.org/api/http.html#class-httpagent
238
- // maxFreeSockets <number> Maximum number of sockets per host to leave open in a free state. Only relevant if keepAlive is set to true. Default: 256.
236
+ ,maxTotalSockets: (process.env.MAX_TOTAL_SOCKETS === undefined ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS))
239
237
 
240
- ,timeout: (process.env.TIMEOUT === undefined ? 10000 : parseInt(process.env.TIMEOUT))
238
+ // maxFreeSockets <number> Maximum number of sockets per host to leave open in a free state. Only relevant if keepAlive is set to true. Default: 256.
241
239
  // Reference: https://nodejs.org/api/http.html#class-httpagent
240
+ ,maxFreeSockets: (process.env.MAX_FREE_SOCKETS === undefined ? 256 : parseInt(process.env.MAX_FREE_SOCKETS))
241
+
242
242
  // timeout <number> Socket timeout in milliseconds. This will set the timeout when the socket is created.
243
+ // Reference: https://nodejs.org/api/http.html#class-httpagent
244
+ ,timeout: (process.env.TIMEOUT === undefined ? 10000 : parseInt(process.env.TIMEOUT))
243
245
 
244
246
  // Maximum payload size allowed for express server calls
245
247
  ,maxPayloadSize: (process.env.MAX_PAYLOAD_SIZE === undefined ? '50mb' : process.env.MAX_PAYLOAD_SIZE)
@@ -0,0 +1 @@
1
+ testfilepassword
package/stsconfig.test.js DELETED
@@ -1,85 +0,0 @@
1
-
2
- describe("Test", () =>
3
- {
4
- beforeAll(async () =>
5
- {
6
-
7
- });
8
-
9
- afterAll(async () =>
10
- {
11
-
12
- });
13
-
14
- test('Checking default config items', async () =>
15
- {
16
- expect.assertions(21);
17
-
18
- process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
19
- let goptions = require('./stsconfig.js').$options;
20
-
21
- expect(goptions.isProduction).toEqual(false);
22
- expect(goptions.consoleLogErrors).toEqual(false);
23
- expect(goptions.dbuser).toEqual('postgres');
24
- expect(goptions.dbpassword).toEqual('password');
25
- expect(goptions.dbpasswordfile).toEqual(undefined);
26
- expect(goptions.dbhost).toEqual('localhost');
27
- expect(goptions.dbport).toEqual('5432');
28
- expect(goptions.database).toEqual('stsrestmsdb01');
29
- expect(goptions.databaseUrl).toEqual(undefined);
30
- expect(goptions.databasescriptfolder).toEqual('/var/lib/sts/stsglobalresources/db-scripts');
31
-
32
- expect(goptions.poolSize).toEqual(500);
33
- expect(goptions.useCPUs).toEqual(-1);
34
- expect(goptions.respawnOnFail).toEqual(false);
35
- expect(goptions.defaultDatabaseEntries).toEqual(10000);
36
- expect(goptions.useRedis).toEqual(false);
37
- expect(goptions.endFlush).toEqual(false);
38
- expect(goptions.redisPort).toEqual('6379');
39
- expect(goptions.redisServer).toEqual('localhost');
40
- expect(goptions.k6ScriptPath).toEqual('.');
41
- expect(goptions.defaultDatabaseMinExtraDataSize).toEqual(0);
42
- expect(goptions.defaultDatabaseMaxExtraDataSize).toEqual(2000);
43
- });
44
-
45
- test('Checking default rest01 service config', async () =>
46
- {
47
- expect.assertions(11);
48
-
49
- process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
50
- let goptions = require('./stsconfig.js').$options;
51
-
52
- expect(goptions.rest01endpoint).toEqual('http://localhost');
53
- expect(goptions.rest01hostport).toEqual('3003');
54
- expect(goptions.rest01port).toEqual('3003');
55
- expect(goptions.rest01apiroot).toEqual('/stsrest01/v1');
56
- expect(goptions.rest01prometheussupport).toEqual(true);
57
- expect(goptions.rest01prometheusclusterport).toEqual('3013');
58
- expect(goptions.rest01servicename).toEqual('STSRest01');
59
- expect(goptions.rest01serviceversion).toEqual('1.0.0');
60
- expect(goptions.rest01email).toEqual('K6TestUser@sts');
61
- expect(goptions.rest01password).toEqual('K6TestUserPassword');
62
- expect(goptions.rest01passwordfile).toEqual(undefined);
63
- });
64
-
65
- test('Checking default instrument manager service config', async () =>
66
- {
67
- expect.assertions(11);
68
-
69
- process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
70
- let goptions = require('./stsconfig.js').$options;
71
-
72
- expect(goptions.imendpoint).toEqual('http://localhost');
73
- expect(goptions.imhostport).toEqual('3001');
74
- expect(goptions.import).toEqual('3001');
75
- expect(goptions.imapiroot).toEqual('/stsinstrumentmanager/v1');
76
- expect(goptions.imprometheussupport).toEqual(true);
77
- expect(goptions.imprometheusclusterport).toEqual('3011');
78
- expect(goptions.imservicename).toEqual('STSInstrumentManager');
79
- expect(goptions.imserviceversion).toEqual('1.0.0');
80
- expect(goptions.imemail).toEqual('K6TestUser@sts');
81
- expect(goptions.impassword).toEqual('K6TestUserPassword');
82
- expect(goptions.impasswordfile).toEqual(undefined);
83
- });
84
- });
85
-