slnodejs 6.1.1068 → 6.1.1069
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 +10 -1
- package/lib/preload.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,9 @@ NODE_OPTIONS="-r ./node_modules/slnodejs/lib/preload.js" node your-script.js
|
|
|
56
56
|
| `SL_TOKEN_FILE` | Path to file containing the Sealights token | `./sltoken.txt` |
|
|
57
57
|
| `SL_BUILD_SESSION_ID` | Direct build session ID | |
|
|
58
58
|
| `SL_BUILD_SESSION_ID_FILE`| Path to file containing build session ID | `./buildSessionId` |
|
|
59
|
-
| `SL_PROJECT_ROOT` | Root directory of your project
|
|
59
|
+
| `SL_PROJECT_ROOT` | Root directory of your project | Current working directory|
|
|
60
|
+
| `SL_COLLECTOR_URL` | URL to Sealights collector | |
|
|
61
|
+
| `SL_LAB_ID` | Lab ID for test execution | |
|
|
60
62
|
|
|
61
63
|
---
|
|
62
64
|
|
|
@@ -103,6 +105,13 @@ export NODE_OPTIONS="-r ./node_modules/slnodejs/lib/preload.js"
|
|
|
103
105
|
SL_TOKEN_FILE="/custom/path/token.txt" SL_projectRoot="/path/to/project" node server.js
|
|
104
106
|
```
|
|
105
107
|
|
|
108
|
+
### Using Collector URL and Lab ID with `NODE_OPTIONS`
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
export NODE_OPTIONS="-r ./node_modules/slnodejs/lib/preload.js"
|
|
112
|
+
SL_TOKEN="your-token-here" SL_COLLECTOR_URL="https://your-collector-url.com" SL_LAB_ID="your-lab-id" node server.js
|
|
113
|
+
```
|
|
114
|
+
|
|
106
115
|
### Debug Mode with `NODE_OPTIONS`
|
|
107
116
|
|
|
108
117
|
```bash
|
package/lib/preload.js
CHANGED
|
@@ -38,9 +38,19 @@ function main() {
|
|
|
38
38
|
projectRoot = `--projectRoot ${process.env.SL_projectRoot || process.env.SL_PROJECT_ROOT}`;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
let labId = '';
|
|
42
|
+
if (process.env.SL_labId || process.env.SL_LAB_ID) {
|
|
43
|
+
labId = `--labId ${process.env.SL_labId || process.env.SL_LAB_ID}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let collectorUrl = '';
|
|
47
|
+
if (process.env.SL_collectorUrl || process.env.SL_COLLECTOR_URL) {
|
|
48
|
+
collectorUrl = `--collectorUrl ${process.env.SL_collectorUrl || process.env.SL_COLLECTOR_URL}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
const [argv0, ...restArgv] = process.argv.map(x => x.includes(' ') ? `"${x}"` : x);
|
|
42
52
|
const originalArgv = process.argv.join(' ');
|
|
43
|
-
const args = ['run', ...token.split(' '), ...bsid.split(' '), ...projectRoot.split(' '), '--', ...restArgv]
|
|
53
|
+
const args = ['run', ...token.split(' '), ...bsid.split(' '), ...projectRoot.split(' '), ...labId.split(' '), ...collectorUrl.split(' '), '--', ...restArgv]
|
|
44
54
|
.filter(x => x); // remove unset arguments
|
|
45
55
|
const processArgs = [pathToSlAgentCli, ...args];
|
|
46
56
|
process.env.NODE_OPTIONS = '';
|