@nsshunt/stsconfig 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env-default CHANGED
@@ -141,6 +141,23 @@ AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key
141
141
  # Auth Server - Public Key (when using JWT)
142
142
  AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key
143
143
 
144
+ # STSBroker Server endpoint
145
+ BROKER_ENDPOINT=http://localhost
146
+ # STSBroker Server port (listen port for the service)
147
+ BROKER_HOST_PORT=3006
148
+ # STSBroker Server port (client port to access the service)
149
+ BROKER_PORT=3006
150
+ # STSBroker Server endpoint
151
+ BROKER_APIROOT=/stsbroker/v1.0
152
+ # STSBroker Prometheus metric support
153
+ BROKER_PROM_SUPPORT=true
154
+ # STSBroker Cluster Server port (port used for cluster prometheus scrapes). Service will listen on this port at mount point /metrics
155
+ BROKER_PROM_CLUSTER_PORT=3016
156
+ # STSBroker Service Name
157
+ BROKER_SERVICE_NAME=STSBroker
158
+ # STSBroker Service Version
159
+ BROKER_SERVICE_VERSION=1.0.0
160
+
144
161
  # STS Test Runner Prometheus metric support
145
162
  TR_PROM_SUPPORT=true
146
163
  # STS Test Runner Cluster Server port (port used for cluster prometheus scrapes)
package/.env-test-file-2 CHANGED
@@ -95,6 +95,21 @@ AS_ACCESS_TOKEN_EXPIRE=432000
95
95
  AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key-c
96
96
  AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key-c
97
97
 
98
+ BROKER_ENDPOINT=http://localhost-c
99
+ BROKER_HOST_PORT=3006-c
100
+ BROKER_PORT=3006-c
101
+ BROKER_APIROOT=/stsbroker/v1.0-c
102
+ BROKER_PROM_SUPPORT=false
103
+ BROKER_PROM_CLUSTER_PORT=3016-c
104
+ BROKER_SERVICE_NAME=STSBroker-c
105
+ BROKER_SERVICE_VERSION=1.0.0-c
106
+ BROKER_API_IDENTIFIER=xyz
107
+ BROKER_API_IDENTIFIER_FILE=testapiidentifierFile
108
+ BROKER_CLIENT_ID=xyz
109
+ BROKER_CLIENT_ID_FILE=testclientidfile
110
+ BROKER_CLIENT_SECRET=xyz
111
+ BROKER_CLIENT_SECRET_FILE=testclientsecretfile
112
+
98
113
  TR_PROM_SUPPORT=false
99
114
  TR_PROM_CLUSTER_PORT=30150
100
115
  TR_SERVICE_NAME=STSRestRunner-c
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsconfig",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "",
5
5
  "main": "stsconfig.js",
6
6
  "dependencies": {
@@ -165,6 +165,29 @@ describe("Test implicit config settings", () =>
165
165
  expect(goptions.trclientsecretfile).toEqual(undefined);
166
166
  });
167
167
 
168
+ test('Checking default broker service config', async () =>
169
+ {
170
+ expect.assertions(14);
171
+
172
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
173
+ let goptions = require('./stsconfig.js').$options;
174
+
175
+ expect(goptions.brokerendpoint).toEqual('http://localhost');
176
+ expect(goptions.brokerhostport).toEqual('3006');
177
+ expect(goptions.brokerport).toEqual('3006');
178
+ expect(goptions.brokerapiroot).toEqual('/stsbroker/v1.0');
179
+ expect(goptions.brokerprometheussupport).toEqual(true);
180
+ expect(goptions.brokerprometheusclusterport).toEqual('3016');
181
+ expect(goptions.brokerservicename).toEqual('STSBroker');
182
+ expect(goptions.brokerserviceversion).toEqual('1.0.0');
183
+ expect(goptions.brokerapiidentifier).toEqual(undefined);
184
+ expect(goptions.brokerapiidentifierfile).toEqual(undefined);
185
+ expect(goptions.brokerclientid).toEqual(undefined);
186
+ expect(goptions.brokerclientidfile).toEqual(undefined);
187
+ expect(goptions.brokerclientsecret).toEqual(undefined);
188
+ expect(goptions.brokerclientsecretfile).toEqual(undefined);
189
+ });
190
+
168
191
  test('Checking default additional config items', async () =>
169
192
  {
170
193
  expect.assertions(22);
@@ -165,6 +165,29 @@ describe("Test configured settings", () =>
165
165
  expect(goptions.trclientsecretfile).toEqual('testclientsecretfile');
166
166
  });
167
167
 
168
+ test('Checking default broker service config', async () =>
169
+ {
170
+ expect.assertions(14);
171
+
172
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
173
+ let goptions = require('./stsconfig.js').$options;
174
+
175
+ expect(goptions.brokerendpoint).toEqual('http://localhost-c');
176
+ expect(goptions.brokerhostport).toEqual('3006-c');
177
+ expect(goptions.brokerport).toEqual('3006-c');
178
+ expect(goptions.brokerapiroot).toEqual('/stsbroker/v1.0-c');
179
+ expect(goptions.brokerprometheussupport).toEqual(false);
180
+ expect(goptions.brokerprometheusclusterport).toEqual('3016-c');
181
+ expect(goptions.brokerservicename).toEqual('STSBroker-c');
182
+ expect(goptions.brokerserviceversion).toEqual('1.0.0-c');
183
+ expect(goptions.brokerapiidentifier).toEqual('testapiidentifierfilecontents');
184
+ expect(goptions.brokerapiidentifierfile).toEqual('testapiidentifierFile');
185
+ expect(goptions.brokerclientid).toEqual('testclientidfilecontents');
186
+ expect(goptions.brokerclientidfile).toEqual('testclientidfile'); // testclientidfile
187
+ expect(goptions.brokerclientsecret).toEqual('testclientsecretfilecontents');
188
+ expect(goptions.brokerclientsecretfile).toEqual('testclientsecretfile');
189
+ });
190
+
168
191
  test('Checking default additional config items', async () =>
169
192
  {
170
193
  expect.assertions(22);
@@ -165,6 +165,29 @@ describe("Test explicit default config settings", () =>
165
165
  expect(goptions.trclientsecretfile).toEqual(undefined);
166
166
  });
167
167
 
168
+ test('Checking default broker service config', async () =>
169
+ {
170
+ expect.assertions(14);
171
+
172
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
173
+ let goptions = require('./stsconfig.js').$options;
174
+
175
+ expect(goptions.brokerendpoint).toEqual('http://localhost');
176
+ expect(goptions.brokerhostport).toEqual('3006');
177
+ expect(goptions.brokerport).toEqual('3006');
178
+ expect(goptions.brokerapiroot).toEqual('/stsbroker/v1.0');
179
+ expect(goptions.brokerprometheussupport).toEqual(true);
180
+ expect(goptions.brokerprometheusclusterport).toEqual('3016');
181
+ expect(goptions.brokerservicename).toEqual('STSBroker');
182
+ expect(goptions.brokerserviceversion).toEqual('1.0.0');
183
+ expect(goptions.brokerapiidentifier).toEqual(undefined);
184
+ expect(goptions.brokerapiidentifierfile).toEqual(undefined);
185
+ expect(goptions.brokerclientid).toEqual(undefined);
186
+ expect(goptions.brokerclientidfile).toEqual(undefined);
187
+ expect(goptions.brokerclientsecret).toEqual(undefined);
188
+ expect(goptions.brokerclientsecretfile).toEqual(undefined);
189
+ });
190
+
168
191
  test('Checking default additional config items', async () =>
169
192
  {
170
193
  expect.assertions(22);
package/stsconfig.js CHANGED
@@ -214,7 +214,41 @@ const defconfig =
214
214
  ,asprivatekeypath: (process.env.AS_PRIVATE_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/private.key" : process.env.AS_PRIVATE_KEY_PATH)
215
215
  // Auth Server - [DEPRECATED] Public Key (when using JWT)
216
216
  ,aspublickeypath: (process.env.AS_PUBLIC_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/public.key" : process.env.AS_PUBLIC_KEY_PATH)
217
-
217
+
218
+ // STS Broker Server
219
+ // ---------------
220
+ // The STS broker server is a BFF service used for STS SPAs. The service will use 1st party secured cookies for session management.
221
+ // The service also provides proxy API access to other STS and/or external services.
222
+ //
223
+ // STSBroker Server endpoint
224
+ ,brokerendpoint: (process.env.BROKER_ENDPOINT === undefined ? "http://localhost" : process.env.BROKER_ENDPOINT)
225
+ // STSBroker Server port (listen port for the service)
226
+ ,brokerhostport: (process.env.BROKER_HOST_PORT === undefined ? "3006" : process.env.BROKER_HOST_PORT)
227
+ // STSBroker Server port (client port to access the service)
228
+ ,brokerport: (process.env.BROKER_PORT === undefined ? "3006" : process.env.BROKER_PORT)
229
+ // STSBroker Server endpoint
230
+ ,brokerapiroot: (process.env.BROKER_APIROOT === undefined ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT)
231
+ // STSBroker API Identifier. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
232
+ ,brokerapiidentifier: process.env.BROKER_API_IDENTIFIER
233
+ // STSBroker API Identifier file. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
234
+ ,brokerapiidentifierfile: process.env.BROKER_API_IDENTIFIER_FILE
235
+ // STSBroker Prometheus metric support
236
+ ,brokerprometheussupport: (process.env.BROKER_PROM_SUPPORT === undefined ? true : (process.env.BROKER_PROM_SUPPORT === "true" ? true : false))
237
+ // STSBroker Cluster Server port (port used for cluster prometheus scrapes). Service will listen on this port at mount point /metrics
238
+ ,brokerprometheusclusterport: (process.env.BROKER_PROM_CLUSTER_PORT === undefined ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT)
239
+ // STSBroker Service Name
240
+ ,brokerservicename: (process.env.BROKER_SERVICE_NAME === undefined ? "STSBroker" : process.env.BROKER_SERVICE_NAME)
241
+ // STSBroker Service Version
242
+ ,brokerserviceversion: (process.env.BROKER_SERVICE_VERSION === undefined ? "1.0.0" : process.env.BROKER_SERVICE_VERSION)
243
+ // STSBroker Server client ID. Used for oauth2 client credentials flow.
244
+ ,brokerclientid: process.env.BROKER_CLIENT_ID
245
+ // STSBroker Server client ID file. Used for oauth2 client credentials flow.
246
+ ,brokerclientidfile: process.env.BROKER_CLIENT_ID_FILE
247
+ // STSBroker Server client secret. Used for oauth2 client credentials flow.
248
+ ,brokerclientsecret: process.env.BROKER_CLIENT_SECRET
249
+ // STSBroker Server client secret file. Used for oauth2 client credentials flow.
250
+ ,brokerclientsecretfile: process.env.BROKER_CLIENT_SECRET_FILE
251
+
218
252
  // STS Test Runner Prometheus metric support
219
253
  ,trprometheussupport: (process.env.TR_PROM_SUPPORT === undefined ? true : (process.env.TR_PROM_SUPPORT === "true" ? true : false ))
220
254
  // STS Test Runner Cluster Server port (port used for cluster prometheus scrapes)
@@ -397,17 +431,20 @@ const fileconfig = [
397
431
  { fileprop: 'asoauthapiidentifierfile', prop: 'asoauthapiidentifier' },
398
432
  { fileprop: 'asadminapiidentifierfile', prop: 'asadminapiidentifier' },
399
433
  { fileprop: 'rest01apiidentifierfile', prop: 'rest01apiidentifier' },
434
+ { fileprop: 'brokerapiidentifierfile', prop: 'brokerapiidentifier' },
400
435
  { fileprop: 'toapiidentifierfile', prop: 'toapiidentifier' },
401
436
  { fileprop: 'imapiidentifierfile', prop: 'imapiidentifier' },
402
437
  // Client ID file processing
403
438
  { fileprop: 'asclientidfile', prop: 'asclientid' },
404
439
  { fileprop: 'rest01clientidfile', prop: 'rest01clientid' },
440
+ { fileprop: 'brokerclientidfile', prop: 'brokerclientid' },
405
441
  { fileprop: 'toclientidfile', prop: 'toclientid' },
406
442
  { fileprop: 'imclientidfile', prop: 'imclientid' },
407
443
  { fileprop: 'trclientidfile', prop: 'trclientid' },
408
444
  // Client secret file processing
409
445
  { fileprop: 'asclientsecretfile', prop: 'asclientsecret' },
410
446
  { fileprop: 'rest01clientsecretfile', prop: 'rest01clientsecret' },
447
+ { fileprop: 'brokerclientsecretfile', prop: 'brokerclientsecret' },
411
448
  { fileprop: 'toclientsecretfile', prop: 'toclientsecret' },
412
449
  { fileprop: 'imclientsecretfile', prop: 'imclientsecret' },
413
450
  { fileprop: 'trclientsecretfile', prop: 'trclientsecret' },