@nsshunt/stsconfig 1.9.1 → 1.12.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-test-file-1 +0 -0
- package/.env-test-file-2 +167 -0
- package/package.json +3 -4
- package/stsconfig.js +156 -85
- package/stsconfig.test.js +68 -3
package/.env-test-file-1
ADDED
|
File without changes
|
package/.env-test-file-2
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
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
|
|
25
|
+
|
|
26
|
+
PUBLISH_DEBUG=false
|
|
27
|
+
PUBLISH_TIMEOUT=750
|
|
28
|
+
PUBLISH_INTERVAL=1000
|
|
29
|
+
|
|
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
|
|
42
|
+
|
|
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
|
|
55
|
+
|
|
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
|
|
68
|
+
|
|
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
|
|
81
|
+
|
|
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
|
|
90
|
+
|
|
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
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsshunt/stsconfig",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "stsconfig.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"colors": "^1.4.0",
|
|
8
8
|
"debug": "^4.3.3",
|
|
9
|
-
"dotenv": "^16.0.0"
|
|
10
|
-
"yaml": "^1.10.2"
|
|
9
|
+
"dotenv": "^16.0.0"
|
|
11
10
|
},
|
|
12
11
|
"standard": {
|
|
13
12
|
"parser": "@babel/eslint-parser"
|
|
@@ -17,7 +16,7 @@
|
|
|
17
16
|
"@babel/eslint-parser": "^7.17.0",
|
|
18
17
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
19
18
|
"@babel/plugin-proposal-private-methods": "^7.16.11",
|
|
20
|
-
"eslint": "^8.
|
|
19
|
+
"eslint": "^8.10.0",
|
|
21
20
|
"jest": "^27.5.1"
|
|
22
21
|
},
|
|
23
22
|
"scripts": {
|
package/stsconfig.js
CHANGED
|
@@ -1,59 +1,50 @@
|
|
|
1
|
-
const YAML = require('yaml');
|
|
2
1
|
const { accessSync, constants, readFileSync } = require('fs');
|
|
3
2
|
const debug = require('debug')(`proc:${process.pid}`);
|
|
4
3
|
require('colors');
|
|
5
4
|
|
|
5
|
+
// Order for config settings
|
|
6
|
+
// -------------------------
|
|
7
|
+
// Passwords;
|
|
8
|
+
// Use password specified within a database password file (if present)
|
|
9
|
+
// Fall back to use a password from an environment variable
|
|
10
|
+
|
|
6
11
|
// Add tthe STSENVFILE to script run commands in order to use the require .env file for configuration
|
|
7
|
-
let envfile = (process.env.STSENVFILE === undefined ? '
|
|
8
|
-
let yamlfile = (process.env.STSYAMLFILE === undefined ? '../stsglobalresources/config.yml' : process.env.STSYAMLFILE);
|
|
12
|
+
let envfile = (process.env.STSENVFILE === undefined ? '/.env' : process.env.STSENVFILE);
|
|
9
13
|
|
|
10
14
|
require('dotenv').config({ path: envfile });
|
|
11
15
|
|
|
12
|
-
let deffileconfig = { };
|
|
13
|
-
try {
|
|
14
|
-
accessSync(yamlfile, constants.R_OK);
|
|
15
|
-
const file = readFileSync(yamlfile, 'utf8');
|
|
16
|
-
deffileconfig = YAML.parse(file);
|
|
17
|
-
} catch (err) {
|
|
18
|
-
debug(`Problem loading YAML file: [${yamlfile}], Error: [${err}]`.yellow);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
16
|
const defconfig =
|
|
22
17
|
{
|
|
23
18
|
// Node runtime environment
|
|
24
|
-
isProduction: process.env.NODE_ENV === 'production'
|
|
19
|
+
isProduction: (process.env.NODE_ENV === undefined ? false : process.env.NODE_ENV === 'production')
|
|
25
20
|
// Log error messages to the console within the microservice
|
|
26
21
|
,consoleLogErrors: (process.env.CONSOLE_LOG_ERRORS === undefined ? false : (process.env.CONSOLE_LOG_ERRORS === "true" ? true : false ))
|
|
27
22
|
// Database username.
|
|
28
|
-
,dbuser: process.env.DB_USER
|
|
23
|
+
,dbuser: (process.env.DB_USER === undefined ? 'postgres' : process.env.DB_USER)
|
|
29
24
|
// Database password.
|
|
30
|
-
,dbpassword: process.env.DB_PASSWORD
|
|
31
|
-
// Database
|
|
32
|
-
,
|
|
33
|
-
// Database
|
|
34
|
-
,
|
|
25
|
+
,dbpassword: (process.env.DB_PASSWORD === undefined ? 'password' : process.env.DB_PASSWORD)
|
|
26
|
+
// Database password file
|
|
27
|
+
,dbpasswordfile: process.env.DB_PASSWORD_FILE
|
|
28
|
+
// Database host
|
|
29
|
+
,dbhost: (process.env.DB_HOST === undefined ? 'localhost' : process.env.DB_HOST)
|
|
30
|
+
// Database port
|
|
31
|
+
,dbport: (process.env.DB_PORT === undefined ? '5432' : process.env.DB_PORT)
|
|
35
32
|
// Database name.
|
|
36
|
-
,database: process.env.DB_DATABASE
|
|
37
|
-
// Database connection string to be used in production mode
|
|
33
|
+
,database: (process.env.DB_DATABASE === undefined ? 'stsrestmsdb01' : process.env.DB_DATABASE) // STS REST MicroService Database 01
|
|
34
|
+
// Database connection string to be used in production mode
|
|
38
35
|
,databaseUrl: process.env.DATABASE_URL
|
|
39
|
-
// Computed connection string to be used in development mode.
|
|
40
|
-
,connectionString: `postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_DATABASE}`
|
|
41
|
-
// Default computed connection string for postgres. Database name = postgres.
|
|
42
|
-
,defaultDatabaseConnectionString: `postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/postgres`
|
|
43
36
|
// Database script(s) folder
|
|
44
37
|
,databasescriptfolder: (process.env.DB_SCRIPT_FOLDER === undefined ? "/var/lib/sts/stsglobalresources/db-scripts" : process.env.DB_SCRIPT_FOLDER)
|
|
45
38
|
|
|
46
|
-
// Use the on-screen UI for the server. Set to false for head-less mode (i.e. inside cluster etc.)
|
|
47
|
-
,useui: (process.env.USEUI === undefined ? true : (process.env.USEUI === "true" ? true : false ))
|
|
48
39
|
// The maximum pool size for pg. There will be one pool per thread.
|
|
49
|
-
,poolSize: (process.env.POOL_SIZE === undefined ?
|
|
40
|
+
,poolSize: (process.env.POOL_SIZE === undefined ? 500 : parseInt(process.env.POOL_SIZE))
|
|
50
41
|
// Maximum number of CPUs (incl. logical processors) to use within the Microservice.
|
|
51
42
|
// Use -1 to use all available within the runtime container. Each CPU will spawn a node work thread.
|
|
52
43
|
,useCPUs: (process.env.MAX_CPU === undefined ? -1 : parseFloat(process.env.MAX_CPU))
|
|
53
44
|
// Automatically re-spawn a worker thread if one dies.
|
|
54
45
|
,respawnOnFail: (process.env.RESPAWN === undefined ? false : (process.env.RESPAWN === "true" ? true : false ))
|
|
55
46
|
// Default number of entries to create for a fresh database.
|
|
56
|
-
,defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES
|
|
47
|
+
,defaultDatabaseEntries: (process.env.DEFAULT_DB_ENTRIES === undefined ? 10000 : process.env.DEFAULT_DB_ENTRIES)
|
|
57
48
|
// Microservice listen port.
|
|
58
49
|
,useRedis: (process.env.USE_REDIS === undefined ? false : (process.env.USE_REDIS === "true" ? true : false ))
|
|
59
50
|
// Use redis for Microservice.
|
|
@@ -61,65 +52,28 @@ const defconfig =
|
|
|
61
52
|
// Automatically flush the redis cache when terminating the Microservice.
|
|
62
53
|
,endFlush: (process.env.REDIS_END_FLUSH === undefined ? false : (process.env.REDIS_END_FLUSH === "true" ? true : false ))
|
|
63
54
|
// Redis server port.
|
|
64
|
-
,redisPort: process.env.REDIS_PORT
|
|
55
|
+
,redisPort: (process.env.REDIS_PORT === undefined ? '6379' : process.env.REDIS_PORT)
|
|
65
56
|
// Redis server endpoint.
|
|
66
|
-
,redisServer: process.env.REDIS_SERVER
|
|
57
|
+
,redisServer: (process.env.REDIS_SERVER === undefined ? 'localhost' : process.env.REDIS_SERVER)
|
|
67
58
|
// Default K6 test script path
|
|
68
59
|
,k6ScriptPath: (process.env.K6SCRIPTPATH === undefined ? "." : process.env.K6SCRIPTPATH)
|
|
69
|
-
// Default flag to automatically copy from the source RESFK_ records to the working set RESCP_ records
|
|
70
|
-
// during initial fresh database creation.
|
|
71
|
-
,defaultDatabasePopulate: (process.env.DEFAULT_DB_POPULATE === undefined ? true : (process.env.DEFAULT_DB_POPULATE === "true" ? true : false ))
|
|
72
|
-
// Default flag to automatically populate the redis cache (if enabled) with the current RESCP_ records
|
|
73
|
-
// as they are being created. Only valid when DEFAULT_DB_POPULATE = true AND USE_REDIS = true.
|
|
74
|
-
,defaultRedisPopulate: (process.env.DEFAULT_REDIS_POPULATE === undefined ? true : (process.env.DEFAULT_REDIS_POPULATE === "true" ? true : false))
|
|
75
|
-
// Default number of entries K6 should test against.
|
|
76
|
-
,defaultK6Entries: (process.env.DEFAULT_K6_ENTRIES === undefined ? 100000 : parseInt(process.env.DEFAULT_K6_ENTRIES))
|
|
77
|
-
// Default microservice end-point for K6 tests.
|
|
78
|
-
,defaultK6MicroServiceHost: (process.env.DEFAULT_K6_MS_HOST === undefined ? 'localhost' : process.env.DEFAULT_K6_MS_HOST)
|
|
79
|
-
// Default microservice port for K6 tests.
|
|
80
|
-
,defaultK6MicroServicePort: (process.env.DEFAULT_K6_MS_PORT === undefined ? 3000 : parseInt(process.env.DEFAULT_K6_MS_PORT))
|
|
81
|
-
// Default ratio (%) that each test should be an update rather than just a read.
|
|
82
|
-
,defaultK6MicroServiceUpdateRatio: (process.env.DEFAULT_K6_UPDATE_RATIO === undefined ? 2 : parseInt(process.env.DEFAULT_K6_UPDATE_RATIO))
|
|
83
|
-
// Default ratio (%) that for an update, this update will actually be a delete. Only valid when
|
|
84
|
-
// DEFAULT_K6_UPDATE_RATIO is > 0
|
|
85
|
-
,defaultK6MicroServiceDeleteRatio: (process.env.DEFAULT_K6_DELETE_RATIO === undefined ? 0 : parseInt(process.env.DEFAULT_K6_DELETE_RATIO))
|
|
86
|
-
// Default flag to always create a new record for each interation during K6 test runs. The new
|
|
87
|
-
// record will contain a UUID for the ID to ensure uniqueness.
|
|
88
|
-
,defaultK6MicroServiceAlwaysAdd: (process.env.DEFAULT_K6_ALWAYS_ADD === undefined ? false : (process.env.DEFAULT_K6_ALWAYS_ADD === "true" ? true : false))
|
|
89
|
-
// Default number of virtual CPUs to use on each testing node.
|
|
90
|
-
,defaultK6MicroServiceVCPUs: (process.env.DEFAULT_K6_VCPU === undefined ? 20 : parseInt(process.env.DEFAULT_K6_VCPU))
|
|
91
|
-
// Default duration each test node should run the K6 test.
|
|
92
|
-
,defaultK6MicroServiceDuration: (process.env.DEFAULT_K6_DURATION === undefined ? "30s" : process.env.DEFAULT_K6_DURATION)
|
|
93
|
-
// Default token refresh modulas.
|
|
94
|
-
,defaulttokenrefreshmod: (process.env.DEFAULT_K6_TOKEN_REFRESH_MOD === undefined ? 5000 : parseInt(process.env.DEFAULT_K6_TOKEN_REFRESH_MOD))
|
|
95
|
-
// Default sleep duration (ms) between iterations - random number between 0 and this number.
|
|
96
|
-
,defaultitersleep: (process.env.DEFAULT_K6_ITER_SLEEP === undefined ? 0 : parseInt(process.env.DEFAULT_K6_ITER_SLEEP))
|
|
97
60
|
// Default number of entries to create for a fresh database.
|
|
98
61
|
,defaultDatabaseMinExtraDataSize: (process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === undefined ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE))
|
|
99
62
|
// Default number of entries to create for a fresh database.
|
|
100
63
|
,defaultDatabaseMaxExtraDataSize: (process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === undefined ? 2000 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE))
|
|
101
64
|
|
|
102
|
-
/* To be developed in future ...
|
|
103
|
-
// Config Server (CS) endpoint
|
|
104
|
-
,csendpoint: (process.env.CS_ENDPOINT === undefined ? "http://localhost" : process.env.CS_ENDPOINT)
|
|
105
|
-
// Config Server (CS) port
|
|
106
|
-
,csport: (process.env.CS_PORT === undefined ? "3000" : process.env.CS_PORT)
|
|
107
|
-
// Config Server (CS) endpoint
|
|
108
|
-
,csapiroot: (process.env.CS_APIROOT === undefined ? "/api/v1/k6testing" : process.env.CS_APIROOT)
|
|
109
|
-
// Config Server (CS) username email
|
|
110
|
-
,csemail: (process.env.CS_EMAIL === undefined ? "K6TestUser@sts" : process.env.CS_EMAIL)
|
|
111
|
-
// Config Server (CS) username password
|
|
112
|
-
,cspassword: (process.env.CS_PASSWORD === undefined ? "K6TestUserPassword" : process.env.CS_PASSWORD)
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
65
|
// STSREST01 Server endpoint
|
|
116
66
|
,rest01endpoint: (process.env.REST01_ENDPOINT === undefined ? "http://localhost" : process.env.REST01_ENDPOINT)
|
|
117
67
|
// STSREST01 Server port (listen port for the service)
|
|
118
|
-
,rest01hostport: (process.env.REST01_HOST_PORT === undefined ? "
|
|
68
|
+
,rest01hostport: (process.env.REST01_HOST_PORT === undefined ? "3003" : process.env.REST01_HOST_PORT)
|
|
119
69
|
// STSREST01 Server port (client port to access the service)
|
|
120
|
-
,rest01port: (process.env.REST01_PORT === undefined ? "
|
|
70
|
+
,rest01port: (process.env.REST01_PORT === undefined ? "3003" : process.env.REST01_PORT)
|
|
121
71
|
// STSREST01 Server endpoint
|
|
122
|
-
,rest01apiroot: (process.env.REST01_APIROOT === undefined ? "/stsrest01/v1
|
|
72
|
+
,rest01apiroot: (process.env.REST01_APIROOT === undefined ? "/stsrest01/v1" : process.env.REST01_APIROOT)
|
|
73
|
+
// STSREST01 Prometheus metric support
|
|
74
|
+
,rest01prometheussupport: (process.env.REST01_PROM_SUPPORT === undefined ? true : (process.env.REST01_PROM_SUPPORT === "true" ? true : false))
|
|
75
|
+
// STSREST01 Cluster Server port (port used for cluster prometheus scrapes). Service will listen on this port at mount point /metrics
|
|
76
|
+
,rest01prometheusclusterport: (process.env.REST01_PROM_CLUSTER_PORT === undefined ? "3013" : process.env.REST01_PROM_CLUSTER_PORT)
|
|
123
77
|
// STSREST01 Service Name
|
|
124
78
|
,rest01servicename: (process.env.REST01_SERVICE_NAME === undefined ? "STSRest01" : process.env.REST01_SERVICE_NAME)
|
|
125
79
|
// STSREST01 Service Version
|
|
@@ -130,7 +84,8 @@ const defconfig =
|
|
|
130
84
|
,rest01email: (process.env.REST01_EMAIL === undefined ? "K6TestUser@sts" : process.env.REST01_EMAIL)
|
|
131
85
|
// STSREST01 Server username password
|
|
132
86
|
,rest01password: (process.env.REST01_PASSWORD === undefined ? "K6TestUserPassword" : process.env.REST01_PASSWORD)
|
|
133
|
-
|
|
87
|
+
// STSREST01 Server username password file
|
|
88
|
+
,rest01passwordfile: process.env.REST01_PASSWORD_FILE
|
|
134
89
|
|
|
135
90
|
// STS Instrument Manager Service endpoint
|
|
136
91
|
,imendpoint: (process.env.IM_ENDPOINT === undefined ? "http://localhost" : process.env.IM_ENDPOINT)
|
|
@@ -140,6 +95,10 @@ const defconfig =
|
|
|
140
95
|
,import: (process.env.IM_PORT === undefined ? "3001" : process.env.IM_PORT)
|
|
141
96
|
// STS Instrument Manager Service endpoint
|
|
142
97
|
,imapiroot: (process.env.IM_APIROOT === undefined ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT)
|
|
98
|
+
// STS Instrument Manager Prometheus metric support
|
|
99
|
+
,imprometheussupport: (process.env.IM_PROM_SUPPORT === undefined ? true : (process.env.IM_PROM_SUPPORT === "true" ? true : false ))
|
|
100
|
+
// STS Instrument Manager Cluster Server port (port used for cluster prometheus scrapes)
|
|
101
|
+
,imprometheusclusterport: (process.env.IM_PROM_CLUSTER_PORT === undefined ? "3011" : process.env.IM_PROM_CLUSTER_PORT)
|
|
143
102
|
// STS Instrument Manager Service Name
|
|
144
103
|
,imservicename: (process.env.IM_SERVICE_NAME === undefined ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME)
|
|
145
104
|
// STS Instrument Manager Service Version
|
|
@@ -150,6 +109,8 @@ const defconfig =
|
|
|
150
109
|
,imemail: (process.env.IM_EMAIL === undefined ? "K6TestUser@sts" : process.env.IM_EMAIL)
|
|
151
110
|
// STS Instrument Manager Service username password
|
|
152
111
|
,impassword: (process.env.IM_PASSWORD === undefined ? "K6TestUserPassword" : process.env.IM_PASSWORD)
|
|
112
|
+
// STS Instrument Manager Service username password file
|
|
113
|
+
,impasswordfile: process.env.IM_PASSWORD_FILE
|
|
153
114
|
|
|
154
115
|
// STS Test Orchestrator Service endpoint
|
|
155
116
|
,toendpoint: (process.env.TO_ENDPOINT === undefined ? "http://localhost" : process.env.TO_ENDPOINT)
|
|
@@ -159,6 +120,10 @@ const defconfig =
|
|
|
159
120
|
,toport: (process.env.TO_PORT === undefined ? "3004" : process.env.TO_PORT)
|
|
160
121
|
// STS Test Orchestrator Service endpoint
|
|
161
122
|
,toapiroot: (process.env.TO_APIROOT === undefined ? "/ststestorchestrator/v1" : process.env.TO_APIROOT)
|
|
123
|
+
// STS Test Orchestrator Prometheus metric support
|
|
124
|
+
,toprometheussupport: (process.env.TO_PROM_SUPPORT === undefined ? true : (process.env.TO_PROM_SUPPORT === "true" ? true : false ))
|
|
125
|
+
// STS Test Orchestrator Cluster Server port (port used for cluster prometheus scrapes)
|
|
126
|
+
,toprometheusclusterport: (process.env.TO_PROM_CLUSTER_PORT === undefined ? "3014" : process.env.TO_PROM_CLUSTER_PORT)
|
|
162
127
|
// STS Test Orchestrator Service Name
|
|
163
128
|
,toservicename: (process.env.TO_SERVICE_NAME === undefined ? "STSTestOrchestrator" : process.env.TO_SERVICE_NAME)
|
|
164
129
|
// STS Test Orchestrator Service Version
|
|
@@ -169,6 +134,8 @@ const defconfig =
|
|
|
169
134
|
,toemail: (process.env.TO_EMAIL === undefined ? "K6TestUser@sts" : process.env.TO_EMAIL)
|
|
170
135
|
// STS Test Orchestrator Service username password
|
|
171
136
|
,topassword: (process.env.TO_PASSWORD === undefined ? "K6TestUserPassword" : process.env.TO_PASSWORD)
|
|
137
|
+
// STS Test Orchestrator Service username password file
|
|
138
|
+
,topasswordfile: process.env.TO_PASSWORD_FILE
|
|
172
139
|
|
|
173
140
|
// Auth Server endpoint
|
|
174
141
|
,asendpoint: (process.env.AS_ENDPOINT === undefined ? "http://localhost" : process.env.AS_ENDPOINT)
|
|
@@ -178,6 +145,10 @@ const defconfig =
|
|
|
178
145
|
,asport: (process.env.AS_PORT === undefined ? "3002" : process.env.AS_PORT)
|
|
179
146
|
// Auth Server endpoint
|
|
180
147
|
,asapiroot: (process.env.AS_APIROOT === undefined ? "/stsauth/v1" : process.env.AS_APIROOT)
|
|
148
|
+
// Auth Server Prometheus metric support
|
|
149
|
+
,asprometheussupport: (process.env.AS_PROM_SUPPORT === undefined ? true : (process.env.AS_PROM_SUPPORT === "true" ? true : false ))
|
|
150
|
+
// Auth Prometheus Cluster Server port (port used for cluster prometheus scrapes)
|
|
151
|
+
,asprometheusclusterport: (process.env.AS_PROM_CLUSTER_PORT === undefined ? "3012" : process.env.AS_PROM_CLUSTER_PORT)
|
|
181
152
|
// STSAuth Service Name
|
|
182
153
|
,asservicename: (process.env.AS_SERVICE_NAME === undefined ? "STSAuth" : process.env.AS_SERVICE_NAME)
|
|
183
154
|
// STSAuth Service Version
|
|
@@ -188,7 +159,17 @@ const defconfig =
|
|
|
188
159
|
,asemail: (process.env.AS_EMAIL === undefined ? "K6TestUser@sts" : process.env.AS_EMAIL)
|
|
189
160
|
// Auth Server username password
|
|
190
161
|
,aspassword: (process.env.AS_PASSWORD === undefined ? "K6TestUserPassword" : process.env.AS_PASSWORD)
|
|
162
|
+
// Auth Server username password file
|
|
163
|
+
,aspasswordfile: process.env.AS_PASSWORD_FILE
|
|
164
|
+
// Auth Server - Private Key (when using JWT)
|
|
165
|
+
,asprivatekeypath: (process.env.AS_PRIVATE_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/private.key" : process.env.AS_PRIVATE_KEY_PATH)
|
|
166
|
+
// Auth Server - Public Key (when using JWT)
|
|
167
|
+
,aspublickeypath: (process.env.AS_PUBLIC_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/public.key" : process.env.AS_PUBLIC_KEY_PATH)
|
|
191
168
|
|
|
169
|
+
// STS Test Runner Prometheus metric support
|
|
170
|
+
,trprometheussupport: (process.env.TR_PROM_SUPPORT === undefined ? true : (process.env.TR_PROM_SUPPORT === "true" ? true : false ))
|
|
171
|
+
// STS Test Runner Cluster Server port (port used for cluster prometheus scrapes)
|
|
172
|
+
,trprometheusclusterport: (process.env.TR_PROM_CLUSTER_PORT === undefined ? "3015" : process.env.TR_PROM_CLUSTER_PORT)
|
|
192
173
|
// STS Test Runner Service Name
|
|
193
174
|
,trservicename: (process.env.TR_SERVICE_NAME === undefined ? "STSRestRunner" : process.env.TR_SERVICE_NAME)
|
|
194
175
|
// STS Test Runner Service Version
|
|
@@ -199,14 +180,8 @@ const defconfig =
|
|
|
199
180
|
,tremail: (process.env.TR_EMAIL === undefined ? "K6TestUser@sts" : process.env.TR_EMAIL)
|
|
200
181
|
// STS Test Runner password
|
|
201
182
|
,trpassword: (process.env.TR_PASSWORD === undefined ? "K6TestUserPassword" : process.env.TR_PASSWORD)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
,asprivatekeypath: (process.env.AS_PRIVATE_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/private.key" : process.env.AS_PRIVATE_KEY_PATH)
|
|
205
|
-
// Auth Server - Public Key
|
|
206
|
-
,aspublickeypath: (process.env.AS_PUBLIC_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/public.key" : process.env.AS_PUBLIC_KEY_PATH)
|
|
207
|
-
|
|
208
|
-
// Special flags
|
|
209
|
-
,monitor: (process.env.MONITOR === undefined ? false : (process.env.MONITOR === "true" ? true : false ))
|
|
183
|
+
// STS Test Runner password file
|
|
184
|
+
,trpasswordfile: process.env.TR_PASSWORD_FILE
|
|
210
185
|
|
|
211
186
|
// Duration (in ms) between each publish event.
|
|
212
187
|
,publishinterval: (process.env.PUBLISH_INTERVAL === undefined ? 1000 : parseInt(process.env.PUBLISH_INTERVAL))
|
|
@@ -221,6 +196,7 @@ const defconfig =
|
|
|
221
196
|
// Transport(s) to use for sending instrumentation data to the instrumentation server
|
|
222
197
|
,transport: (process.env.TRANSPORT === undefined ? 0 : process.env.TRANSPORT)
|
|
223
198
|
|
|
199
|
+
/*
|
|
224
200
|
// Instrument Defaults
|
|
225
201
|
// Logger lines (sliding window size)
|
|
226
202
|
,instrumentLoggerSize: (process.env.INSTRUMENT_LOGGER_SIZE === undefined ? 200 : parseInt(process.env.INSTRUMENT_LOGGER_SIZE))
|
|
@@ -233,6 +209,7 @@ const defconfig =
|
|
|
233
209
|
|
|
234
210
|
// Sample size (number of readings to use for P(x) calculations. Time approx. (Sample Interval / 1000) * Sample Size, i.e. Caluclate P(x) on the observed data for the last 6 minutes.
|
|
235
211
|
,instrumentSampleSize: (process.env.INSTRUMENT_SAMPLE_SIZE === undefined ? 600 : parseInt(process.env.INSTRUMENT_SAMPLE_SIZE))
|
|
212
|
+
*/
|
|
236
213
|
|
|
237
214
|
// Use secure cookies option when passing back cookies from STS services (such as STSAuth service).
|
|
238
215
|
// This setting will be ignore for production mode. In production mode services will always use secure cookies.
|
|
@@ -263,9 +240,103 @@ const defconfig =
|
|
|
263
240
|
,timeout: (process.env.TIMEOUT === undefined ? 10000 : parseInt(process.env.TIMEOUT))
|
|
264
241
|
// Reference: https://nodejs.org/api/http.html#class-httpagent
|
|
265
242
|
// timeout <number> Socket timeout in milliseconds. This will set the timeout when the socket is created.
|
|
243
|
+
|
|
244
|
+
// Maximum payload size allowed for express server calls
|
|
245
|
+
,maxPayloadSize: (process.env.MAX_PAYLOAD_SIZE === undefined ? '50mb' : process.env.MAX_PAYLOAD_SIZE)
|
|
246
|
+
|
|
247
|
+
// Instrumentation Config Settings
|
|
248
|
+
// -------------------------------
|
|
249
|
+
// Generic interval (ms) to make on observation for instrumentation objects.
|
|
250
|
+
,instrumentationObservationInterval: (process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === undefined ? 1000 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL))
|
|
251
|
+
|
|
252
|
+
// Generic sliding time window (seconds) for instrumentation objects that process telemetry over time (e.g. P(x) instruments).
|
|
253
|
+
,instrumentationTimeWindow: (process.env.INSTRUMENTATION_TIME_WINDOW === undefined ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW))
|
|
254
|
+
|
|
255
|
+
// Service Specific Config Settings
|
|
256
|
+
// --------------------------------
|
|
257
|
+
// STSAuth
|
|
258
|
+
// -------
|
|
259
|
+
// Define the valid age for a JWT access token (in ms). Default 10 minutes.
|
|
260
|
+
,authJWTAccessTokenTimeout: (process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === undefined ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT))
|
|
261
|
+
|
|
262
|
+
// Define the valid age for a JWT refresh token (in ms). Default 24 hours.
|
|
263
|
+
,authJWTRefreshTokenTimeout: (process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === undefined ? (3600 * 24) : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT))
|
|
264
|
+
|
|
265
|
+
// Define the valid age for an authentication/session cookie. Default 24 hours.
|
|
266
|
+
,authCookieTimeout: (process.env.AUTH_COOKIE_TIMEOUT === undefined ? (3600 * 24) : parseInt(process.env.AUTH_COOKIE_TIMEOUT))
|
|
267
|
+
|
|
268
|
+
// STSAppFramework (library)
|
|
269
|
+
// -------------------------
|
|
270
|
+
// Define the time (ms) to wait prior to exiting the application (using process.exit(0))
|
|
271
|
+
,masterProcessExitTime: (process.env.MASTER_PROCESS_EXIT_TIME === undefined ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME))
|
|
272
|
+
|
|
273
|
+
// Define the time (ms) to wait prior to exiting the application (using process.exit(0))
|
|
274
|
+
,childProcessExitTime: (process.env.CHILD_PROCESS_EXIT_TIME === undefined ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME))
|
|
275
|
+
|
|
276
|
+
// Define the interval (ms) to collect system information for instrumentation purposes
|
|
277
|
+
,systemInformationInterval: (process.env.SYSTEM_INFORMATION_INTERVAL === undefined ? 1000 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL))
|
|
278
|
+
|
|
279
|
+
// Ignore socket.io REST api calls and/or WebSocket calls when collecting telemetry for instrumentation purposes.
|
|
280
|
+
,ignoresocketio: (process.env.IGNORE_SOCKETIO === undefined ? true : (process.env.IGNORE_SOCKETIO === "true" ? true : false ))
|
|
281
|
+
|
|
282
|
+
/*
|
|
283
|
+
// STSModels (library)
|
|
284
|
+
// -------------------
|
|
285
|
+
// Define the interval for checking instrumentation updates on a instrumentation model. Entries in the model will be removed after this timeout value (ms) if no
|
|
286
|
+
// activity has been detected. Default 5 seconds.
|
|
287
|
+
,modelPurgeUpdateTimeout: (process.env.MODEL_PURGE_UPDATE_TIMEOUT === undefined ? 5000 : parseInt(process.env.MODEL_PURGE_UPDATE_TIMEOUT))
|
|
288
|
+
*/
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const ReadPasswordFile = (passwordFile) => {
|
|
292
|
+
try {
|
|
293
|
+
accessSync(passwordFile, constants.R_OK);
|
|
294
|
+
const data = readFileSync(passwordFile, 'utf8');
|
|
295
|
+
debug(`Successfully loaded password file: [${passwordFile}]`.green);
|
|
296
|
+
return data;
|
|
297
|
+
} catch (err) {
|
|
298
|
+
debug(`Problem loading password file: [${passwordFile}], Error: [${err}]`.red);
|
|
299
|
+
return "";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Database password file
|
|
304
|
+
if (defconfig.dbpasswordfile !== undefined) {
|
|
305
|
+
defconfig.dbpassword = ReadPasswordFile(defconfig.dbpasswordfile);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Auth Server username password file
|
|
309
|
+
if (defconfig.aspasswordfile !== undefined) {
|
|
310
|
+
defconfig.aspassword = ReadPasswordFile(defconfig.aspasswordfile);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// STSREST01 Server username password file
|
|
314
|
+
if (defconfig.rest01passwordfile !== undefined) {
|
|
315
|
+
defconfig.rest01password = ReadPasswordFile(defconfig.rest01passwordfile);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// STS Test Runner password file
|
|
319
|
+
if (defconfig.trpasswordfile !== undefined) {
|
|
320
|
+
defconfig.trpassword = ReadPasswordFile(defconfig.trpasswordfile);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// STS Test Orchestrator Service username password file
|
|
324
|
+
if (defconfig.topasswordfile !== undefined) {
|
|
325
|
+
defconfig.topassword = ReadPasswordFile(defconfig.topasswordfile);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// STS Instrument Manager Service username password file
|
|
329
|
+
if (defconfig.impasswordfile !== undefined) {
|
|
330
|
+
defconfig.impassword = ReadPasswordFile(defconfig.impasswordfile);
|
|
266
331
|
}
|
|
267
332
|
|
|
268
333
|
// Preference order is YAML file then .env file
|
|
269
|
-
const $options = {
|
|
334
|
+
const $options = {
|
|
335
|
+
...defconfig
|
|
336
|
+
// Computed connection string to be used in development mode.
|
|
337
|
+
,connectionString: `postgresql://${defconfig.dbuser}:${defconfig.dbpassword}@${defconfig.dbhost}:${defconfig.dbport}/${defconfig.database}`
|
|
338
|
+
// Default computed connection string for postgres. Database name = postgres. Used by utilites that create and/or update the STS database(s).
|
|
339
|
+
,defaultDatabaseConnectionString: `postgresql://${defconfig.dbuser}:${defconfig.dbpassword}@${defconfig.dbhost}:${defconfig.dbport}/postgres`
|
|
340
|
+
}
|
|
270
341
|
|
|
271
342
|
module.exports = { $options }
|
package/stsconfig.test.js
CHANGED
|
@@ -11,10 +11,75 @@ describe("Test", () =>
|
|
|
11
11
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
test('
|
|
14
|
+
test('Checking default config items', async () =>
|
|
15
15
|
{
|
|
16
|
-
expect.assertions(
|
|
17
|
-
|
|
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);
|
|
18
83
|
});
|
|
19
84
|
});
|
|
20
85
|
|