@mimik/local 7.0.8 → 7.1.1
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/README.md +332 -223
- package/dotFiles/eslint.config.js +10 -12
- package/eslint.config.js +10 -6
- package/index.js +358 -273
- package/lib/common.js +149 -142
- package/lib/helpers.js +12 -11
- package/lib/rp-axios-wrapper.js +4 -4
- package/lib/tasks.js +36 -57
- package/manual-test/getAPI.js +2 -2
- package/manual-test/testMerge.js +3 -3
- package/manual-test/testString.js +2 -3
- package/package.json +8 -8
- package/scripts.json +2 -1
- package/configuration/config.js +0 -57
package/README.md
CHANGED
|
@@ -1,111 +1,122 @@
|
|
|
1
1
|
<a name="module_local"></a>
|
|
2
2
|
|
|
3
3
|
## local
|
|
4
|
-
|
|
4
|
+
Utilities for local deployment.
|
|
5
5
|
|
|
6
6
|
The following files are expected to exist:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
|
|
8
|
+
In the directory **above** the server’s root directory: `mSTConfig.json`, `mIDConfig.json`, `mITConfig.json`, `sumoLog.json`, `kinesisLog.json`, `s3Log.json`, `customerConfig.json`, `key.json`, and `locationConfig.json`. If they don’t exist when the script launches, defaults will be set up.
|
|
9
|
+
|
|
10
|
+
- For `mSTConfig.json`:
|
|
11
|
+
```javascript
|
|
10
12
|
{
|
|
11
|
-
"basePath": "
|
|
12
|
-
"protocol": "
|
|
13
|
-
"domainName": "
|
|
14
|
-
"port": "
|
|
15
|
-
"passphrase": "
|
|
16
|
-
"update": "
|
|
13
|
+
"basePath": "Base path of the mST server, e.g., `/mST/v1`",
|
|
14
|
+
"protocol": "Protocol for the mST server, e.g., `http:` (default: `http:`)",
|
|
15
|
+
"domainName": "Domain name of the mST server",
|
|
16
|
+
"port": "Port for the mST server, e.g., `8025`",
|
|
17
|
+
"passphrase": "Passphrase used to generate the public/private key pair; if not present, mST will use a regular key",
|
|
18
|
+
"update": "Whether mST should be updated (default: `false`). If the address is localhost, mST will be updated.",
|
|
17
19
|
"admin": {
|
|
18
|
-
"clientId": "
|
|
19
|
-
"clientSecret": "secret
|
|
20
|
+
"clientId": "Client ID used to obtain an mST admin token, e.g., `12345`",
|
|
21
|
+
"clientSecret": "Client secret used to obtain an mST admin token, e.g., `timeForSecret`"
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
```
|
|
23
|
-
`domainName` must
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
`domainName` must exist. When `domainName` is `localhost`, `port` must also exist. When `domainName` is `localhost`, the local IP will replace `localhost`. When `domainName` is different from `localhost`, `port` is ignored.
|
|
26
|
+
|
|
27
|
+
- For `mIDConfig.json`:
|
|
28
|
+
```javascript
|
|
26
29
|
{
|
|
27
|
-
"basePath": "
|
|
28
|
-
"protocol": "
|
|
29
|
-
"domainName": "
|
|
30
|
-
"port": "
|
|
30
|
+
"basePath": "Base path of the mID server, e.g., `/mID/v1`",
|
|
31
|
+
"protocol": "Protocol for the mID server, e.g., `http:` (default: `http:`)",
|
|
32
|
+
"domainName": "Domain name of the mID server",
|
|
33
|
+
"port": "Port for the mID server, e.g., `8015`",
|
|
31
34
|
"implicit": {
|
|
32
|
-
"key": "
|
|
33
|
-
"audience": "
|
|
35
|
+
"key": "Key to sign and verify the signature of a user token, e.g., `timeForSecret`",
|
|
36
|
+
"audience": "URL defining the audience used in the user token, e.g., `https://mimik`"
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
The same `domainName`/`port` rules as in `mSTConfig.json` apply.
|
|
41
|
+
|
|
42
|
+
- For `mITConfig.json`:
|
|
43
|
+
```javascript
|
|
40
44
|
{
|
|
41
|
-
"basePath": "
|
|
42
|
-
"protocol": "
|
|
43
|
-
"domainName": "
|
|
44
|
-
"port": "
|
|
45
|
+
"basePath": "Base path of the mIT server, e.g., `/mIT/v1`",
|
|
46
|
+
"protocol": "Protocol for the mIT server, e.g., `http:` (default: `http:`)",
|
|
47
|
+
"domainName": "Domain name of the mIT server",
|
|
48
|
+
"port": "Port for the mIT server, e.g., `8050`"
|
|
45
49
|
}
|
|
46
50
|
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
The same `domainName`/`port` rules as in `mSTConfig.json` apply.
|
|
52
|
+
|
|
53
|
+
- For `sumoLog.json`:
|
|
54
|
+
```javascript
|
|
50
55
|
{
|
|
51
56
|
"<serverType>": {
|
|
52
|
-
"url": "
|
|
53
|
-
"code": "code for
|
|
57
|
+
"url": "Base URL for Sumo Logic, e.g., `https://endpoint2.collection.us2.sumologic.com/receiver/v1/http/`",
|
|
58
|
+
"code": "The code for Sumo Logic (the part after the last `/` in the URL)"
|
|
54
59
|
},
|
|
55
60
|
"default": {
|
|
56
|
-
"url": "
|
|
57
|
-
"code": "code for
|
|
61
|
+
"url": "Base URL for Sumo Logic, e.g., `https://endpoint2.collection.us2.sumologic.com/receiver/v1/http/`",
|
|
62
|
+
"code": "The code for Sumo Logic (the part after the last `/` in the URL)"
|
|
63
|
+
}
|
|
58
64
|
}
|
|
59
65
|
```
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
|
|
67
|
+
- For `kinesisLog.json`:
|
|
68
|
+
```javascript
|
|
62
69
|
{
|
|
63
|
-
"region": "
|
|
64
|
-
"accessKeyId": "
|
|
65
|
-
"secretAccessKey": "
|
|
66
|
-
"streamNameInfo": "
|
|
67
|
-
"streamNameError": "
|
|
68
|
-
"streamNameOther": "
|
|
70
|
+
"region": "Region of the Kinesis implementation",
|
|
71
|
+
"accessKeyId": "Access key ID for Kinesis",
|
|
72
|
+
"secretAccessKey": "Secret access key for Kinesis",
|
|
73
|
+
"streamNameInfo": "Name of the Kinesis stream for info",
|
|
74
|
+
"streamNameError": "Name of the Kinesis stream for errors",
|
|
75
|
+
"streamNameOther": "Name of the Kinesis stream for all other levels"
|
|
69
76
|
}
|
|
70
77
|
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
78
|
+
|
|
79
|
+
- For `s3Log.json`:
|
|
80
|
+
```javascript
|
|
81
|
+
{
|
|
82
|
+
"region": "Region of the S3 implementation",
|
|
83
|
+
"accessKeyId": "Access key ID for S3",
|
|
84
|
+
"secretAccessKey": "Secret access key for S3",
|
|
85
|
+
"bucketname": "Name of the S3 bucket used to store information",
|
|
86
|
+
"maxEvents": "Number of events buffered before sending to S3 (integer)",
|
|
87
|
+
"timeout": "Number of seconds before a timeout triggers sending to S3 (integer)",
|
|
88
|
+
"maxSize": "Maximum size in bytes before sending to S3 (integer)"
|
|
89
|
+
}
|
|
82
90
|
```
|
|
91
|
+
|
|
83
92
|
- for `key.json`:
|
|
84
|
-
```
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
"username": "
|
|
88
|
-
"password": "
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
93
|
+
```javascript
|
|
94
|
+
{
|
|
95
|
+
"bitbucket": {
|
|
96
|
+
"username": "Username to access the Bitbucket account",
|
|
97
|
+
"password": "Password to access the Bitbucket account"
|
|
98
|
+
},
|
|
99
|
+
"swaggerhub": "Key to access private APIs on SwaggerHub"
|
|
100
|
+
}
|
|
92
101
|
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
|
|
103
|
+
- For `locationConfig.json`:
|
|
104
|
+
```javascript
|
|
105
|
+
{
|
|
106
|
+
"url": "URL of the location provider",
|
|
107
|
+
"key": "API key used to make requests to the location provider"
|
|
108
|
+
}
|
|
99
109
|
```
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
Additionally `example-testStart.json` is used
|
|
106
|
-
The configuration of these files depends on the configuration parameters
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
|
|
111
|
+
A property may be defined for each `serverType` involved. If the `serverType` does not exist, the `default` entry is used.
|
|
112
|
+
|
|
113
|
+
- for `customerConfig.json`: see `mST` `README.md` file for an example of a customer configuration. This may have to be updated to reflect the new server.
|
|
114
|
+
- In the `local` directory under the server’s root directory: two files, `start.json` and `testStart.json`, may exist. `start.json` is used when `npm start` is executed; `testStart.json` is used when `npm test` is executed.
|
|
115
|
+
If these files don’t exist, `example-start.json` is used to create `start.json` and `testStart.json`. Additionally, `example-testStart.json` is used to create `testStart.json`; values in `example-testStart.json` take precedence over values in `example-start.json`.
|
|
116
|
+
The configuration of these files depends on the server’s configuration parameters.
|
|
117
|
+
|
|
118
|
+
Example `start.json` for `mIT`:
|
|
119
|
+
```javascript
|
|
109
120
|
{
|
|
110
121
|
"NODE_ENV": "local",
|
|
111
122
|
"LOG_LEVEL": "debug",
|
|
@@ -118,29 +129,32 @@ The following is an example of start.json file for `mIT`:
|
|
|
118
129
|
"SERVER_SECURITY_SET": "off"
|
|
119
130
|
}
|
|
120
131
|
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
132
|
+
|
|
133
|
+
Although all files use the `.json` extension, you may still add `//` comments to make them more explicit or to remove parameters.
|
|
134
|
+
|
|
135
|
+
Reserved environment variables used by the library for configuration:
|
|
136
|
+
- `oauthImplicitNeeded`: if the service handles user tokens, the implicit configuration is required
|
|
137
|
+
- `mIDNeeded`: if the service targets mID
|
|
125
138
|
- `locationNeeded`: if location translation is needed
|
|
126
|
-
- `standAlone`: if the service
|
|
139
|
+
- `standAlone`: if the service must operate without other services (if the service has targets, 500 errors are likely)
|
|
127
140
|
|
|
128
|
-
If SERVER_ID is not set in
|
|
141
|
+
If `SERVER_ID` is not set in `start.json` or `testStart.json`, it will be assigned using `uuidv4`.
|
|
129
142
|
|
|
130
|
-
For
|
|
131
|
-
This file contains
|
|
132
|
-
```
|
|
143
|
+
For tests, a JSON file (`server-test.json`) is created in the project root (`.`).
|
|
144
|
+
This file contains information needed to start the tests:
|
|
145
|
+
```javascript
|
|
133
146
|
{
|
|
134
|
-
"start": "
|
|
135
|
-
"CUSTOMER_NAME": "name
|
|
136
|
-
"CUSTOMER_CODE": "code
|
|
137
|
-
"BASE_PATH": "
|
|
138
|
-
"MST_TOKEN": "mST admin token for creating clients
|
|
139
|
-
"ADMIN_TOKEN": "
|
|
140
|
-
"MID_TOKEN": "mID admin token for creating users when `authImplicitNeeded is set
|
|
147
|
+
"start": "Information needed to set environment variables for the test",
|
|
148
|
+
"CUSTOMER_NAME": "Customer name used to set up customer config",
|
|
149
|
+
"CUSTOMER_CODE": "Customer code used to set up customer config (`not available for mST`)",
|
|
150
|
+
"BASE_PATH": "Base path of the API",
|
|
151
|
+
"MST_TOKEN": "mST admin token for creating clients (`not available in standAlone`)",
|
|
152
|
+
"ADMIN_TOKEN": "Admin token of the service (`not available in standAlone`)",
|
|
153
|
+
"MID_TOKEN": "mID admin token for creating users when `authImplicitNeeded` is set (`not available in standAlone`)"
|
|
141
154
|
}
|
|
142
155
|
```
|
|
143
|
-
|
|
156
|
+
|
|
157
|
+
In `standAlone` mode, the test can obtain tokens using `oauth-helper-temp`.
|
|
144
158
|
|
|
145
159
|
**Example**
|
|
146
160
|
```js
|
|
@@ -150,238 +164,333 @@ import { mSTTestSetup, mSTSetup, mITTestSetup, mITSetup, testSetup, setup, dotFi
|
|
|
150
164
|
```
|
|
151
165
|
|
|
152
166
|
* [local](#module_local)
|
|
153
|
-
*
|
|
154
|
-
|
|
155
|
-
*
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
167
|
+
* _static_
|
|
168
|
+
* [.testJsonFile](#module_local.testJsonFile) : <code>string</code>
|
|
169
|
+
* _inner_
|
|
170
|
+
* _async_
|
|
171
|
+
* [~commitCheckMsg()](#module_local..commitCheckMsg) ⇒ <code>Promise</code>
|
|
172
|
+
* _sync_
|
|
173
|
+
* [~mSTTestSetup()](#module_local..mSTTestSetup) ⇒
|
|
174
|
+
* [~mSTSetup()](#module_local..mSTSetup) ⇒
|
|
175
|
+
* [~mITTestSetup()](#module_local..mITTestSetup) ⇒
|
|
176
|
+
* [~mITSetup()](#module_local..mITSetup) ⇒
|
|
177
|
+
* [~testSetup()](#module_local..testSetup) ⇒
|
|
178
|
+
* [~setup()](#module_local..setup) ⇒
|
|
179
|
+
* [~dotFiles()](#module_local..dotFiles) ⇒
|
|
180
|
+
* [~scripts()](#module_local..scripts) ⇒
|
|
181
|
+
* [~unscripts()](#module_local..unscripts) ⇒
|
|
182
|
+
* [~start2process(start)](#module_local..start2process) ⇒
|
|
183
|
+
|
|
184
|
+
<a name="module_local.testJsonFile"></a>
|
|
185
|
+
|
|
186
|
+
### local.testJsonFile : <code>string</code>
|
|
187
|
+
Path to the JSON test file.
|
|
188
|
+
|
|
189
|
+
**Kind**: static constant of [<code>local</code>](#module_local)
|
|
190
|
+
<a name="module_local..commitCheckMsg"></a>
|
|
191
|
+
|
|
192
|
+
### local~commitCheckMsg() ⇒ <code>Promise</code>
|
|
193
|
+
Check the validity of the commit message.
|
|
194
|
+
|
|
195
|
+
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
196
|
+
**Returns**: <code>Promise</code> - .
|
|
197
|
+
**Category**: async
|
|
198
|
+
**Fulfil**: `null`.
|
|
159
199
|
|
|
200
|
+
Exits with code `1` if the commit message is not correct or if the branch is not a Jira generated branch.
|
|
160
201
|
<a name="module_local..mSTTestSetup"></a>
|
|
161
202
|
|
|
162
203
|
### local~mSTTestSetup() ⇒
|
|
163
|
-
|
|
204
|
+
Set up `mST` for tests.
|
|
164
205
|
|
|
165
206
|
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
166
207
|
**Returns**: `null`.
|
|
167
208
|
|
|
168
|
-
|
|
209
|
+
Exits with code `1` on error.
|
|
169
210
|
|
|
170
|
-
|
|
211
|
+
Actions performed:
|
|
171
212
|
|
|
172
|
-
1.
|
|
173
|
-
2.
|
|
213
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
214
|
+
2. Generate a JSON object and store it in a file in the project root (`.`) to enable tests.
|
|
174
215
|
|
|
175
|
-
|
|
216
|
+
Files required:
|
|
176
217
|
|
|
177
218
|
| Filename | Description |
|
|
178
219
|
| -------- | ----------- |
|
|
179
|
-
| `../sumoLog.json` |
|
|
180
|
-
| `../kinesisLog.json` |
|
|
181
|
-
| `../s3Log.json` |
|
|
182
|
-
| `../mSTConfig.json` |
|
|
183
|
-
| `../mITConfig.json` |
|
|
184
|
-
|
|
|
220
|
+
| `../sumoLog.json` | Sumologic endpoints and code
|
|
221
|
+
| `../kinesisLog.json` | AWS Kinesis configuration
|
|
222
|
+
| `../s3Log.json` | AWS S3 configuration
|
|
223
|
+
| `../mSTConfig.json` | mST configuration
|
|
224
|
+
| `../mITConfig.json` | mIT configuration
|
|
225
|
+
| `../locationConfig.json` | Location provider URL and key (when needed)
|
|
226
|
+
| `../key.json` | Github username and password or Swaggerhub key
|
|
227
|
+
| `./local/testStart.json` | Local configuration (if it does not exist, `example-start.json` will be used to create `testStart.json`)
|
|
185
228
|
**Category**: sync
|
|
186
229
|
<a name="module_local..mSTSetup"></a>
|
|
187
230
|
|
|
188
231
|
### local~mSTSetup() ⇒
|
|
189
|
-
|
|
232
|
+
Set up `mST`.
|
|
190
233
|
|
|
191
234
|
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
192
235
|
**Returns**: `null`.
|
|
193
236
|
|
|
194
|
-
|
|
237
|
+
Exits with code `1` on error.
|
|
195
238
|
|
|
196
|
-
|
|
239
|
+
Actions performed:
|
|
197
240
|
|
|
198
|
-
1.
|
|
199
|
-
2.
|
|
241
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
242
|
+
2. Generate a shell script in the project root (`.`) to start the server.
|
|
200
243
|
|
|
201
|
-
|
|
244
|
+
Files required:
|
|
202
245
|
|
|
203
246
|
| Filename | Description |
|
|
204
247
|
| -------- | ----------- |
|
|
205
|
-
| `../sumoLog.json` |
|
|
206
|
-
| `../kinesisLog.json` |
|
|
207
|
-
| `../s3Log.json` |
|
|
208
|
-
| `../mSTConfig.json` |
|
|
209
|
-
| `../mITConfig.json` |
|
|
210
|
-
|
|
|
248
|
+
| `../sumoLog.json` | Sumologic endpoints and code
|
|
249
|
+
| `../kinesisLog.json` | AWS Kinesis configuration
|
|
250
|
+
| `../s3Log.json` | AWS S3 configuration
|
|
251
|
+
| `../mSTConfig.json` | mST configuration
|
|
252
|
+
| `../mITConfig.json` | mIT configuration
|
|
253
|
+
| `../locationConfig.json` | Location provider URL and key (when needed)
|
|
254
|
+
| `../key.json` | Github username and password or Swaggerhub key
|
|
255
|
+
| `./local/start.json` | Local configuration (if it does not exist, `example-start.json` will be used to create `start.json`)
|
|
211
256
|
**Category**: sync
|
|
212
257
|
<a name="module_local..mITTestSetup"></a>
|
|
213
258
|
|
|
214
259
|
### local~mITTestSetup() ⇒
|
|
215
|
-
|
|
260
|
+
Set up `mIT` for tests.
|
|
216
261
|
|
|
217
262
|
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
218
263
|
**Returns**: `null`.
|
|
219
264
|
|
|
220
|
-
|
|
265
|
+
Exits with code `1` on error.
|
|
221
266
|
|
|
222
267
|
Two modes are available:
|
|
223
|
-
1. stand alone
|
|
224
|
-
2. with mST
|
|
225
268
|
|
|
226
|
-
|
|
227
|
-
|
|
269
|
+
1. Standalone
|
|
270
|
+
2. With mST
|
|
228
271
|
|
|
229
|
-
|
|
230
|
-
2. get an admin token for that service
|
|
231
|
-
3. generate a JSON object store in a file under .
|
|
272
|
+
The environment variable `STAND_ALONE` selects the mode.
|
|
232
273
|
|
|
233
|
-
|
|
274
|
+
When **standalone**, the following actions are performed:
|
|
234
275
|
|
|
235
|
-
|
|
276
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
277
|
+
2. Obtain an admin token for the service.
|
|
278
|
+
3. Generate a JSON object and store it in a file under the project root (`.`).
|
|
236
279
|
|
|
237
|
-
|
|
238
|
-
2. get an admin token for mST
|
|
239
|
-
3. register the service in mST
|
|
240
|
-
4. register an admin client for that service in mST
|
|
241
|
-
5. get an admin token for that service
|
|
242
|
-
6. get an admin token for mID if needed
|
|
243
|
-
7. generate a JSON object store in a file under .
|
|
280
|
+
In `standAlone` mode, dependencies are not reachable and operations that contact dependencies will most likely return a 500 error.
|
|
244
281
|
|
|
245
|
-
|
|
282
|
+
When **mST and other servers are present**, the following actions are performed:
|
|
283
|
+
|
|
284
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
285
|
+
2. Obtain an admin token for mST.
|
|
286
|
+
3. Register the service in mST.
|
|
287
|
+
4. Register an admin client for the service in mST.
|
|
288
|
+
5. Obtain an admin token for the service.
|
|
289
|
+
6. Obtain an admin token for mID if needed.
|
|
290
|
+
7. Generate a JSON object and store it in a file under the project root (`.`).
|
|
291
|
+
|
|
292
|
+
Files required:
|
|
246
293
|
|
|
247
294
|
| Filename | Description |
|
|
248
295
|
| -------- | ----------- |
|
|
249
|
-
| `../sumoLog.json` |
|
|
250
|
-
| `../kinesisLog.json` |
|
|
251
|
-
| `../s3Log.json` |
|
|
252
|
-
| `../mSTConfig.json` |
|
|
253
|
-
| `../mITConfig.json` |
|
|
254
|
-
|
|
|
296
|
+
| `../sumoLog.json` | Sumologic endpoints and code
|
|
297
|
+
| `../kinesisLog.json` | AWS Kinesis configuration
|
|
298
|
+
| `../s3Log.json` | AWS S3 configuration
|
|
299
|
+
| `../mSTConfig.json` | mST configuration
|
|
300
|
+
| `../mITConfig.json` | mIT configuration
|
|
301
|
+
| `../locationConfig.json` | Location provider URL and key (when needed)
|
|
302
|
+
| `../key.json` | Github username and password or Swaggerhub key
|
|
303
|
+
| `./local/testStart.json` | Local configuration (if it does not exist, `example-start.json` will be used to create `testStart.json`)
|
|
255
304
|
**Category**: sync
|
|
256
305
|
<a name="module_local..mITSetup"></a>
|
|
257
306
|
|
|
258
307
|
### local~mITSetup() ⇒
|
|
259
|
-
|
|
308
|
+
Set up `mIT`.
|
|
260
309
|
|
|
261
310
|
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
262
311
|
**Returns**: `null`.
|
|
263
312
|
|
|
264
|
-
|
|
313
|
+
Exits with code `1` on error.
|
|
265
314
|
|
|
266
315
|
Two modes are available:
|
|
267
|
-
1. stand alone
|
|
268
|
-
2. with mST
|
|
269
316
|
|
|
270
|
-
|
|
271
|
-
|
|
317
|
+
1. Standalone
|
|
318
|
+
2. With mST
|
|
272
319
|
|
|
273
|
-
|
|
274
|
-
2. get an admin token for that service
|
|
275
|
-
3. generate a shell script to start the server
|
|
320
|
+
The environment variable `STAND_ALONE` selects the mode.
|
|
276
321
|
|
|
277
|
-
|
|
322
|
+
When **standalone**, the following actions are performed:
|
|
278
323
|
|
|
279
|
-
|
|
324
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
325
|
+
2. Obtain an admin token for the service.
|
|
326
|
+
3. Generate a shell script in the project root (`.`) to start the server.
|
|
280
327
|
|
|
281
|
-
|
|
282
|
-
2. get an admin token for mST
|
|
283
|
-
3. register the service in mST
|
|
284
|
-
4. generate a shell script to start the server
|
|
328
|
+
In `standAlone` mode, dependencies are not reachable and operations that contact dependencies will most likely return a 500 error.
|
|
285
329
|
|
|
286
|
-
|
|
330
|
+
When **mST is present**, the following actions are performed:
|
|
331
|
+
|
|
332
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
333
|
+
2. Obtain an admin token for mST.
|
|
334
|
+
3. Register the service in mST.
|
|
335
|
+
4. Generate a shell script in the project root (`.`) to start the server.
|
|
336
|
+
|
|
337
|
+
Files required:
|
|
287
338
|
|
|
288
339
|
| Filename | Description |
|
|
289
340
|
| -------- | ----------- |
|
|
290
|
-
| `../sumoLog.json` |
|
|
291
|
-
| `../kinesisLog.json` |
|
|
292
|
-
| `../s3Log.json` |
|
|
293
|
-
| `../mSTConfig.json` |
|
|
294
|
-
| `../mITConfig.json` |
|
|
295
|
-
|
|
|
341
|
+
| `../sumoLog.json` | Sumologic endpoints and code
|
|
342
|
+
| `../kinesisLog.json` | AWS Kinesis configuration
|
|
343
|
+
| `../s3Log.json` | AWS S3 configuration
|
|
344
|
+
| `../mSTConfig.json` | mST configuration
|
|
345
|
+
| `../mITConfig.json` | mIT configuration
|
|
346
|
+
| `../locationConfig.json` | Location provider URL and key (when needed)
|
|
347
|
+
| `../key.json` | Github username and password or Swaggerhub key
|
|
348
|
+
| `./local/start.json` | Local configuration (if it does not exist, `example-start.json` will be used to create `start.json`)
|
|
296
349
|
**Category**: sync
|
|
297
350
|
<a name="module_local..testSetup"></a>
|
|
298
351
|
|
|
299
352
|
### local~testSetup() ⇒
|
|
300
|
-
|
|
353
|
+
Set up a service (not mST or mIT) for tests.
|
|
301
354
|
|
|
302
355
|
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
303
356
|
**Returns**: `null`.
|
|
304
357
|
|
|
305
|
-
|
|
358
|
+
Exits with code `1` on error.
|
|
306
359
|
|
|
307
360
|
Two modes are available:
|
|
308
|
-
1. stand alone
|
|
309
|
-
2. with mST, mID are other dependent servers
|
|
310
361
|
|
|
311
|
-
|
|
312
|
-
|
|
362
|
+
1. Standalone
|
|
363
|
+
2. With mST/mID and other dependent servers
|
|
313
364
|
|
|
314
|
-
|
|
315
|
-
2. get an admin token for that service
|
|
316
|
-
3. generate a JSON object store in a file under .
|
|
365
|
+
The environment variable `STAND_ALONE` selects the mode.
|
|
317
366
|
|
|
318
|
-
|
|
367
|
+
When **standalone**, the following actions are performed:
|
|
319
368
|
|
|
320
|
-
|
|
369
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
370
|
+
2. Obtain an admin token for the service.
|
|
371
|
+
3. Generate a JSON object and store it in a file under the project root (`.`).
|
|
321
372
|
|
|
322
|
-
|
|
323
|
-
2. get an admin token for mST
|
|
324
|
-
3. setup the customer in mST
|
|
325
|
-
4. register the service in mST
|
|
326
|
-
5. register an admin client for that service in mST
|
|
327
|
-
6. get an admin token for that service
|
|
328
|
-
7. get an admin token for mID if needed
|
|
329
|
-
8. generate a json object store in a file under .
|
|
373
|
+
In `standAlone` mode, dependencies are not reachable and operations that contact dependencies will most likely return a 500 error.
|
|
330
374
|
|
|
331
|
-
|
|
375
|
+
When **mST and other servers are present**, the following actions are performed:
|
|
376
|
+
|
|
377
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
378
|
+
2. Obtain an admin token for mST.
|
|
379
|
+
3. Set up the customer in mST.
|
|
380
|
+
4. Register the service in mST.
|
|
381
|
+
5. Register an admin client for the service in mST.
|
|
382
|
+
6. Obtain an admin token for the service.
|
|
383
|
+
7. Obtain an admin token for mID if needed.
|
|
384
|
+
8. Generate a JSON object and store it in a file under the project root (`.`).
|
|
385
|
+
|
|
386
|
+
Files required:
|
|
332
387
|
|
|
333
388
|
| Filename | Description |
|
|
334
389
|
| -------- | ----------- |
|
|
335
|
-
| `../sumoLog.json` |
|
|
336
|
-
| `../kinesisLog.json` |
|
|
337
|
-
| `../s3Log.json` |
|
|
338
|
-
| `../mSTConfig.json` |
|
|
339
|
-
| `../mITConfig.json` |
|
|
340
|
-
| `../mIDConfig.json` |
|
|
341
|
-
| `../customerConfig.json` |
|
|
342
|
-
|
|
|
390
|
+
| `../sumoLog.json` | Sumologic endpoints and code
|
|
391
|
+
| `../kinesisLog.json` | AWS Kinesis configuration
|
|
392
|
+
| `../s3Log.json` | AWS S3 configuration
|
|
393
|
+
| `../mSTConfig.json` | mST configuration
|
|
394
|
+
| `../mITConfig.json` | mIT configuration
|
|
395
|
+
| `../mIDConfig.json` | mID configuration (when needed)
|
|
396
|
+
| `../customerConfig.json` | mST customer configuration
|
|
397
|
+
| `../locationConfig.json` | Location provider URL and key (when needed)
|
|
398
|
+
| `../key.json` | Github username and password or Swaggerhub key
|
|
399
|
+
| `./local/testStart.json` | Local configuration (if it does not exist, `example-start.json` will be used to create `testStart.json`)
|
|
343
400
|
**Category**: sync
|
|
344
401
|
<a name="module_local..setup"></a>
|
|
345
402
|
|
|
346
403
|
### local~setup() ⇒
|
|
347
|
-
|
|
404
|
+
Set up a service (not mST or mIT).
|
|
348
405
|
|
|
349
406
|
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
350
407
|
**Returns**: `null`.
|
|
351
408
|
|
|
352
|
-
|
|
409
|
+
Exits with code `1` on error.
|
|
353
410
|
|
|
354
411
|
Two modes are available:
|
|
355
|
-
1.
|
|
356
|
-
2.
|
|
412
|
+
1. Standalone
|
|
413
|
+
2. With mST/mID and other dependent servers
|
|
357
414
|
|
|
358
|
-
The environment variable STAND_ALONE
|
|
359
|
-
When in stand alone, the following actions are being performed:
|
|
415
|
+
The environment variable `STAND_ALONE` selects the mode.
|
|
360
416
|
|
|
361
|
-
|
|
362
|
-
2. get an admin token for that service
|
|
363
|
-
3. generate a shell script to start the server
|
|
417
|
+
When **standalone**, the following actions are performed:
|
|
364
418
|
|
|
365
|
-
|
|
419
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
420
|
+
2. Obtain an admin token for the service.
|
|
421
|
+
3. Generate a shell script to start the server.
|
|
366
422
|
|
|
367
|
-
|
|
423
|
+
In `standAlone` mode, dependencies are not reachable and operations that contact dependencies will most likely return a 500 error.
|
|
368
424
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
425
|
+
When **mST and other servers are present**, the following actions are performed:
|
|
426
|
+
|
|
427
|
+
1. Retrieve the API definition from [SwaggerHub](https://app.swaggerhub.com/search?type=API&owner=mimik).
|
|
428
|
+
2. Obtain an admin token for mST.
|
|
429
|
+
3. Set up the customer in mST.
|
|
430
|
+
4. Register the service in mST.
|
|
431
|
+
5. Generate a shell script in the project root (`.`) to start the server.
|
|
374
432
|
|
|
375
433
|
The following files are needed to perform these actions:
|
|
376
434
|
|
|
377
435
|
| Filename | Description |
|
|
378
436
|
| -------- | ----------- |
|
|
379
|
-
| `../sumo.json` |
|
|
380
|
-
| `../kinesisLog.json` |
|
|
381
|
-
| `../s3Log.json` |
|
|
382
|
-
| `../mSTConfig.json` |
|
|
383
|
-
| `../mITConfig.json` |
|
|
384
|
-
| `../mIDConfig.json` |
|
|
385
|
-
| `../customerConfig.json` |
|
|
386
|
-
|
|
|
437
|
+
| `../sumo.json` | Sumo Logic endpoints and code
|
|
438
|
+
| `../kinesisLog.json` | Kinesis configuration
|
|
439
|
+
| `../s3Log.json` | S3 configuration
|
|
440
|
+
| `../mSTConfig.json` | mST configuration
|
|
441
|
+
| `../mITConfig.json` | mIT configuration
|
|
442
|
+
| `../mIDConfig.json` | mID configuration (when needed)
|
|
443
|
+
| `../customerConfig.json` | mST customer configuration
|
|
444
|
+
| `../locationConfig.json` | Location provider URL and key (when needed)
|
|
445
|
+
| `../key.json` | Github username and password or Swaggerhub key
|
|
446
|
+
| `./local/start.json` | Local configuration (if it does not exist, `example-start.json` will be used to create `start.json`)
|
|
447
|
+
**Category**: sync
|
|
448
|
+
<a name="module_local..dotFiles"></a>
|
|
449
|
+
|
|
450
|
+
### local~dotFiles() ⇒
|
|
451
|
+
Utility to create `rule files`.
|
|
452
|
+
|
|
453
|
+
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
454
|
+
**Returns**: `null`.
|
|
455
|
+
|
|
456
|
+
Creates the `rule files` for:
|
|
457
|
+
|
|
458
|
+
- `eslint` -> `eslint.config.js`.
|
|
459
|
+
- `c8` -> `.nycrc`
|
|
460
|
+
- `github` -> `.gitignore`
|
|
461
|
+
|
|
462
|
+
If a file already exists, it will be overwritten.
|
|
387
463
|
**Category**: sync
|
|
464
|
+
<a name="module_local..scripts"></a>
|
|
465
|
+
|
|
466
|
+
### local~scripts() ⇒
|
|
467
|
+
Utility to add `scripts` and `husky`.
|
|
468
|
+
|
|
469
|
+
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
470
|
+
**Returns**: `null`.
|
|
471
|
+
|
|
472
|
+
Adds `scripts` and `husky` to `package.json`. If a script already exists, it will be overwritten.
|
|
473
|
+
**Category**: sync
|
|
474
|
+
<a name="module_local..unscripts"></a>
|
|
475
|
+
|
|
476
|
+
### local~unscripts() ⇒
|
|
477
|
+
Utility to remove `scripts` and `husky`.
|
|
478
|
+
|
|
479
|
+
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
480
|
+
**Returns**: `null`.
|
|
481
|
+
|
|
482
|
+
Removes `scripts` and `husky` from `package.json`. Only removes the scripts that are in the script file.
|
|
483
|
+
**Category**: sync
|
|
484
|
+
<a name="module_local..start2process"></a>
|
|
485
|
+
|
|
486
|
+
### local~start2process(start) ⇒
|
|
487
|
+
Set up the environment variables based on given JSON object.
|
|
488
|
+
|
|
489
|
+
**Kind**: inner method of [<code>local</code>](#module_local)
|
|
490
|
+
**Returns**: `null`.
|
|
491
|
+
**Category**: sync
|
|
492
|
+
|
|
493
|
+
| Param | Type | Description |
|
|
494
|
+
| --- | --- | --- |
|
|
495
|
+
| start | <code>object</code> | JSON object that is used to configure the environment variables. The comments (starting by //) are ignored. |
|
|
496
|
+
|