Skip to content

Commit 89c7fc8

Browse files
Added agent name in each API call
1 parent 210b5d9 commit 89c7fc8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/main/wrapper/CxConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ export class CxConfig {
77
apiKey: string;
88
tenant: string;
99
additionalParameters:string;
10+
agentName: string;
1011
}

src/main/wrapper/CxWrapper.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export class CxWrapper {
5555
if (cxScanConfig.additionalParameters) {
5656
this.config.additionalParameters = cxScanConfig.additionalParameters;
5757
}
58+
if (cxScanConfig.agentName) {
59+
this.config.agentName = cxScanConfig.agentName;
60+
}
5861
}
5962

6063

@@ -89,6 +92,10 @@ export class CxWrapper {
8992
list.push(param)
9093
})
9194
}
95+
if (this.config.agentName) {
96+
list.push(CxConstants.AGENT);
97+
list.push(this.config.agentName);
98+
}
9299
if (formatRequired) {
93100
list.push(CxConstants.FORMAT);
94101
list.push(CxConstants.FORMAT_JSON);
@@ -144,12 +151,6 @@ export class CxWrapper {
144151
commands.push(CxConstants.ASCA_UPDATE_VERSION);
145152
}
146153

147-
if (agent) {
148-
commands.push(CxConstants.AGENT, agent);
149-
} else {
150-
commands.push(CxConstants.AGENT, '"js-wrapper"');
151-
}
152-
153154
if (ignoredFilePath) {
154155
commands.push(CxConstants.IGNORE__FILE_PATH, ignoredFilePath);
155156
}
@@ -375,10 +376,6 @@ export class CxWrapper {
375376
commands.push(CxConstants.OUTPUT_PATH);
376377
commands.push(outputPath);
377378
}
378-
if (agent) {
379-
commands.push(CxConstants.AGENT);
380-
commands.push(agent);
381-
}
382379
commands.push(...this.initializeCommands(false));
383380
return commands;
384381
}

src/tests/BaseTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export class BaseTest {
88
pathToExecutable: string;
99
tenant: string;
1010
additionalParameters:string;
11+
agentName:string;
1112

1213
constructor() {
1314
this.baseUri = process.env["CX_BASE_URI"];
@@ -16,6 +17,7 @@ export class BaseTest {
1617
this.clientSecret = process.env["CX_CLIENT_SECRET"];
1718
this.tenant = process.env["CX_TENANT"];
1819
this.apiKey = process.env["CX_APIKEY"];
20+
this.agentName = "--agent"
1921
this.additionalParameters = "--debug"
2022
if (process.env["PATH_TO_EXECUTABLE"] !== null && process.env["PATH_TO_EXECUTABLE"] !== undefined) {
2123
this.pathToExecutable = process.env["PATH_TO_EXECUTABLE"];

0 commit comments

Comments
 (0)