Skip to content

Commit 61b323c

Browse files
committed
fix
1 parent 4ab87b1 commit 61b323c

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

src/main/wrapper/CxWrapper.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,43 @@ export class CxWrapper {
1919

2020
constructor(cxScanConfig: CxConfig, logFilePath?: string) {
2121
getLoggerWithFilePath(logFilePath)
22+
const cxInstaller = new CxInstaller(process.platform);
23+
this.config.pathToExecutable = cxInstaller.getExecutablePath();
2224
this.downloadIfNotInstalledCLI(process.platform).then(() => {
23-
logger.info("CLI downloaded successfully")
25+
if (cxScanConfig.apiKey) {
26+
this.config.apiKey = cxScanConfig.apiKey;
27+
} else if (cxScanConfig.clientId && cxScanConfig.clientSecret) {
28+
logger.info("Received clientId and clientSecret");
29+
this.config.clientId = cxScanConfig.clientId;
30+
this.config.clientSecret = cxScanConfig.clientSecret;
31+
} else {
32+
logger.info("Did not receive ClientId/Secret or ApiKey from cli arguments");
33+
}
34+
const executablePath = cxInstaller.getExecutablePath();
35+
if (cxScanConfig.pathToExecutable) {
36+
this.config.pathToExecutable = cxScanConfig.pathToExecutable;
37+
} else if (process.platform === 'win32') {
38+
this.config.pathToExecutable = executablePath;
39+
} else if (process.platform === 'darwin') {
40+
this.config.pathToExecutable = executablePath;
41+
fs.chmodSync(this.config.pathToExecutable, 0o777);
42+
} else {
43+
this.config.pathToExecutable = executablePath;
44+
fs.chmodSync(this.config.pathToExecutable, 0o777);
45+
}
46+
if (cxScanConfig.baseUri) {
47+
this.config.baseUri = cxScanConfig.baseUri;
48+
}
49+
if (cxScanConfig.baseAuthUri) {
50+
this.config.baseAuthUri = cxScanConfig.baseAuthUri;
51+
}
52+
if (cxScanConfig.tenant) {
53+
this.config.tenant = cxScanConfig.tenant;
54+
}
55+
if (cxScanConfig.additionalParameters) {
56+
this.config.additionalParameters = cxScanConfig.additionalParameters;
57+
}
2458
});
25-
const cxInstaller = new CxInstaller(process.platform);
26-
if (cxScanConfig.apiKey) {
27-
this.config.apiKey = cxScanConfig.apiKey;
28-
} else if (cxScanConfig.clientId && cxScanConfig.clientSecret) {
29-
logger.info("Received clientId and clientSecret");
30-
this.config.clientId = cxScanConfig.clientId;
31-
this.config.clientSecret = cxScanConfig.clientSecret;
32-
} else {
33-
logger.info("Did not receive ClientId/Secret or ApiKey from cli arguments");
34-
}
35-
const executablePath = cxInstaller.getExecutablePath();
36-
if (cxScanConfig.pathToExecutable) {
37-
this.config.pathToExecutable = cxScanConfig.pathToExecutable;
38-
} else if (process.platform === 'win32') {
39-
this.config.pathToExecutable = executablePath;
40-
} else if (process.platform === 'darwin') {
41-
this.config.pathToExecutable = executablePath;
42-
fs.chmodSync(this.config.pathToExecutable, 0o777);
43-
} else {
44-
this.config.pathToExecutable = executablePath;
45-
fs.chmodSync(this.config.pathToExecutable, 0o777);
46-
}
47-
if (cxScanConfig.baseUri) {
48-
this.config.baseUri = cxScanConfig.baseUri;
49-
}
50-
if (cxScanConfig.baseAuthUri) {
51-
this.config.baseAuthUri = cxScanConfig.baseAuthUri;
52-
}
53-
if (cxScanConfig.tenant) {
54-
this.config.tenant = cxScanConfig.tenant;
55-
}
56-
if (cxScanConfig.additionalParameters) {
57-
this.config.additionalParameters = cxScanConfig.additionalParameters;
58-
}
5959
}
6060

6161
async downloadIfNotInstalledCLI(os: string){

0 commit comments

Comments
 (0)