@mimik/local 7.1.0 → 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 CHANGED
@@ -1,111 +1,122 @@
1
1
  <a name="module_local"></a>
2
2
 
3
3
  ## local
4
- Set of functions for local deployment.
4
+ Utilities for local deployment.
5
5
 
6
6
  The following files are expected to exist:
7
- In the directory above the server root directory: `mSTConfig.json`, `mIDConfig.json`, `mITConfig.json`,`sumoLog.json`, `kinesisLog.json`, `s3Log.json`, `customerConfig.json`, `key.json`, `locationConfig.json` are being set. If they don't exist at the launch of the script, default will be setup.
8
- - for `mSTConfig.json`:
9
- ``` javascript
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": "base path of the mST server, for example: `/mST/v1`",
12
- "protocol": "protocol for the mST server, for example: `http:`, by default `http:`",
13
- "domainName": "domain name of the mST server",
14
- "port": "port for the mST server, for example: `8025`",
15
- "passphrase": "passphrase to be used to generate public private key pair, if not present mST will user regular key",
16
- "update": "switch to indicate if mST needs to be updated, default is `false`. If the address is localhost, mST will be updated"
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": "id or the client in order to get an admin token for mST, for example: `12345`",
19
- "clientSecret": "secret of the client in order to get an admin token for mST, for example: `timeForSecret`"
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 exit, and when `domainName` is equal to `localhost`, `port` must exist. When `domainName` is equal to `localhost` the `local ip` will replace `localhost`. When `domainName` is different of `localhost` the `port` will be ignored.
24
- - for `mIDConfig.json`:
25
- ``` javascript
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": "base path of the mID server, for example: `/mID/v1`",
28
- "protocol": "protocol for the mID server, for example: `http:`, by default `http:`",
29
- "domainName": "domain name of the mID server",
30
- "port": "port for the mST server, for example: `8015`",
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": "a key to sign and verify the signature of a use token: `timeForSecret`",
33
- "audience": "url defining the audinece used in user token: `https://mimik`"
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
- Similar properties than for mSTConfig on `domainName` and `port` apply.
38
- - for `mITConfig.json`:
39
- ``` javascript
40
+ The same `domainName`/`port` rules as in `mSTConfig.json` apply.
41
+
42
+ - For `mITConfig.json`:
43
+ ```javascript
40
44
  {
41
- "basePath": "base path of the mIT server, for example: `/mIT/v1`",
42
- "protocol": "protocol for the mIT server, for example: `http:`, by default `http:`",
43
- "domainName": "domain name of the mIT server",
44
- "port": "port for the mIT server, for example: `8050`"
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
- Similar properties than for mSTConfig on `domainName` and `port` apply.
48
- - for `sumoLog.json`:
49
- ``` javascript
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": "base URL for sumologic, for example: `https://endpoint2.collection.us2.sumologic.com/receiver/v1/http/`",
53
- "code": "code for sumologic, everything after the last / in the sumologic URL"
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": "base URL for sumologic, for example: `https://endpoint2.collection.us2.sumologic.com/receiver/v1/http/`",
57
- "code": "code for sumologic, everything after the last / in the sumologic URL"
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
- - for `kinesisLog.json`:
61
- ``` javascript
66
+
67
+ - For `kinesisLog.json`:
68
+ ```javascript
62
69
  {
63
- "region": "region of the Kinesis implementation",
64
- "accessKeyId": "access key id of Kinesis",
65
- "secretAccessKey": "secret access key for Kinesis",
66
- "streamNameInfo": "name of the Kinesis stream for info",
67
- "streamNameError": "name of the Kinesis stream for error",
68
- "streamNameOther": "name of the Kinesis stream for all the other levels"
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
- - for `s3Log.json`:
72
- ``` javascript
73
- {
74
- "region": "region of the S3 implementation",
75
- "accessKeyId": "Access key id for S3",
76
- "secretAccessKey": "secret access key for S3",
77
- "bucketname": "name of the S3 bucket used to store the information",
78
- "maxEvents": "number of events buffered before sending to S3 (integer)",
79
- "timeout": "number of seconds before timeout to send to S3 (integer)",
80
- "maxSize": "max size in Bytes before sending to S3 (integer)"
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
- ``` javascript
85
- {
86
- "bitbucket": {
87
- "username": "username to access the bitbucket account",
88
- "password": "password to access the bitbucket account"
89
- },
90
- "swaggerhub": "key to access private API on swaggerhub"
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
- - for `locationConfig.json`:
94
- ``` javascript
95
- {
96
- "url": "url of the location provider"
97
- "key": "key to make request to the location provider"
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
- A property may be defined for each `serverType` involved. If the serverType does not exist the default will be picked.
101
- - for `customerConfig.json`:
102
- See `mST` `README.md` file for an example of a customer configuration. This may have to be updated to reflect the new servers.
103
- - in the `local` directory of the server root directory: two files `start.json` and `testStart.json` may exit. `start.json` is used when `npm start` is executed, `testStart.json` is used when `npm test` is executed.
104
- If the files don't exist `exampe-start.json` is used to create `start.json` and `testStart.json`.
105
- Additionally `example-testStart.json` is used when to create `testStart.json`. The values in `example-testStart.json` take precedence over the values in `example-start.json`.
106
- The configuration of these files depends on the configuration parameters of the server.
107
- The following is an example of start.json file for `mIT`:
108
- ``` javascript
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
- While all the files use the `.json` extension it is still possible to add comments `//` in the file to make the file more explicit or to remove some parameters.
122
- There are reserved environment variables used by the library for configuration:
123
- - `oauthImplicitNeeded`: if the service handles user token the implicit configuration is needed
124
- - `mIDNeeded`: if the service has mID as a target
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 needs to be operated without other service. If the service has targets most likely 500 errors will be generated
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 the start.json or testStart.json file, SERVER_ID will be assigned with a uuid.v4.
141
+ If `SERVER_ID` is not set in `start.json` or `testStart.json`, it will be assigned using `uuidv4`.
129
142
 
130
- For test in json file (`server-test.json`) is created in `.`.
131
- This file contains informations needed to start the test:
132
- ``` javascript
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": "information needed to setup the environment variables for the test",
135
- "CUSTOMER_NAME": "name of the customer to setup customer config",
136
- "CUSTOMER_CODE": "code of the customer to setup coustomer config, `not available for MST`",
137
- "BASE_PATH": "base path of the API",
138
- "MST_TOKEN": "mST admin token for creating clients, `no available in standAlone`",
139
- "ADMIN_TOKEN": "admin token of the service, `no available in standAlone`",
140
- "MID_TOKEN": "mID admin token for creating users when `authImplicitNeeded is set, `not available in standAlone`")
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
- In standAlone mode the test can easily get the token using `oauth-helper-temp`.
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
- * [~mSTTestSetup()](#module_local..mSTTestSetup) ⇒
154
- * [~mSTSetup()](#module_local..mSTSetup)
155
- * [~mITTestSetup()](#module_local..mITTestSetup) ⇒
156
- * [~mITSetup()](#module_local..mITSetup) ⇒
157
- * [~testSetup()](#module_local..testSetup) ⇒
158
- * [~setup()](#module_local..setup) ⇒
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
- Setup mST for test.
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
- Will exit 1 if there is an error.
209
+ Exits with code `1` on error.
169
210
 
170
- The following actions are being performed:
211
+ Actions performed:
171
212
 
172
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
173
- 2. generate a json object stored in a file in . to enable the test
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
- The following files are needed to perform these actions:
216
+ Files required:
176
217
 
177
218
  | Filename | Description |
178
219
  | -------- | ----------- |
179
- | `../sumoLog.json` | The sumologic endpoints and code
180
- | `../kinesisLog.json` | The Kinesis information
181
- | `../s3Log.json` | The S3 information
182
- | `../mSTConfig.json` | The config for mST
183
- | `../mITConfig.json` | The config for mIT
184
- | `./local/testStart.json` | The local configuration. If it does not exist start.json will be used and if start.json does not exist start-example.json will be used to create start.json
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
- Setup mST.
232
+ Set up `mST`.
190
233
 
191
234
  **Kind**: inner method of [<code>local</code>](#module_local)
192
235
  **Returns**: `null`.
193
236
 
194
- Will exit 1 if there is an error.
237
+ Exits with code `1` on error.
195
238
 
196
- The following actions are being performed:
239
+ Actions performed:
197
240
 
198
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
199
- 2. generate a shell script in a file in . to start the server
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
- The following files are needed to perform these actions:
244
+ Files required:
202
245
 
203
246
  | Filename | Description |
204
247
  | -------- | ----------- |
205
- | `../sumoLog.json` | The sumologic endpoints and code
206
- | `../kinesisLog.json` | The Kinesis information
207
- | `../s3Log.json` | The S3 information
208
- | `../mSTConfig.json` | The config for mST
209
- | `../mITConfig.json` | The config for mIT
210
- | `./local/start.json` | The local configuration. If it does not exist start-example.json will be used to create start.json
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
- Setup mIT for test.
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
- Will exit 1 if there is an error.
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
- The environment variable STAND_ALONE will select the mode.
227
- When in stand alone, the following actions are being performed:
269
+ 1. Standalone
270
+ 2. With mST
228
271
 
229
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
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
- In standAlone the dependencies will not be reachable and the operation that implies reaching dependencies will most likely generate a 500 error.
274
+ When **standalone**, the following actions are performed:
234
275
 
235
- When mST and other servers are present, the following actions are being performed:
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
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
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
- The following files are needed to perform these actions:
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` | The sumologic endpoints and code
250
- | `../kinesisLog.json` | The Kinesis information
251
- | `../s3Log.json` | The S3 information
252
- | `../mSTConfig.json` | The config for mST
253
- | `../mITConfig.json` | The config for mIT
254
- | `./local/testStart.json` | The local configuration. If it does not exist start.json will be used and if start.json does not exist start-example.json will be used to create start.json
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
- Setup mIT.
308
+ Set up `mIT`.
260
309
 
261
310
  **Kind**: inner method of [<code>local</code>](#module_local)
262
311
  **Returns**: `null`.
263
312
 
264
- Will exit 1 if there is an error.
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
- The environment variable STAND_ALONE will select the mode.
271
- When in stand alone, the following actions are being performed:
317
+ 1. Standalone
318
+ 2. With mST
272
319
 
273
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
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
- In standAlone the dependencies will not be reachable and the operation that implies reaching dependencies will most likely generate a 500 error.
322
+ When **standalone**, the following actions are performed:
278
323
 
279
- When mST is present, the following actions are being performed:
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
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
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
- The following files are needed to perform these actions:
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` | The sumologic endpoints and code
291
- | `../kinesisLog.json` | The Kinesis information
292
- | `../s3Log.json` | The S3 information
293
- | `../mSTConfig.json` | The config for mST
294
- | `../mITConfig.json` | The config for mIT
295
- | `./local/start.json` | The local configuration. If it does not exist start-example.json will be used to create start.json
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
- Setup a service (not mST, mIT) for test.
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
- Will exit 1 if there is an error.
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
- The environment variable STAND_ALONE will select the mode.
312
- When in stand alone, the following actions are being performed:
362
+ 1. Standalone
363
+ 2. With mST/mID and other dependent servers
313
364
 
314
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
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
- In standAlone the dependencies will not be reachable and the operation that implies reaching dependencies will most likely generate a 500 error.
367
+ When **standalone**, the following actions are performed:
319
368
 
320
- When mST and other servers are present, the following actions are being performed:
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
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
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
- The following files are needed to perform these actions:
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` | The sumologic endpoints and code
336
- | `../kinesisLog.json` | The Kinesis information
337
- | `../s3Log.json` | The S3 information
338
- | `../mSTConfig.json` | The config for mST
339
- | `../mITConfig.json` | The config for mIT
340
- | `../mIDConfig.json` | The config for mID
341
- | `../customerConfig.json` | The mST customer config
342
- | `./local/testStart.json` | The local configuration. If it does not exist start.json will be used and if start.json does not exist start-example.json will be used to create start.json
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
- Setup a service (not mST, mIT).
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
- Will exit 1 if there is an error.
409
+ Exits with code `1` on error.
353
410
 
354
411
  Two modes are available:
355
- 1. stand alone
356
- 2. with mST, mID are other dependent servers
412
+ 1. Standalone
413
+ 2. With mST/mID and other dependent servers
357
414
 
358
- The environment variable STAND_ALONE will select the mode.
359
- When in stand alone, the following actions are being performed:
415
+ The environment variable `STAND_ALONE` selects the mode.
360
416
 
361
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
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
- In standAlone the dependencies will not be reachable and the operation that implies reaching dependencies will most likely generate a 500 error.
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
- When mST and other servers are present, the following actions are being performed:
423
+ In `standAlone` mode, dependencies are not reachable and operations that contact dependencies will most likely return a 500 error.
368
424
 
369
- 1. retrieve the API from [swaggerhub](https://app.swaggerhub.com/search?type=API&owner=mimik)
370
- 2. get an admin token for mST
371
- 3. setup the customer in mST
372
- 4. register the service in mST
373
- 5. generate a shell script to start the server
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` | The sumologic endpoints and code
380
- | `../kinesisLog.json` | The Kinesis information
381
- | `../s3Log.json` | The S3 information
382
- | `../mSTConfig.json` | The config for mST
383
- | `../mITConfig.json` | The config for mIT
384
- | `../mIDConfig.json` | The config for mID
385
- | `../customerConfig.json` | The mST customer config
386
- | `./local/start.json` | The local configuration. If it does not exist start-example.json will be used to create start.json
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
+