@zerothreatai/cli 6.0.6 → 6.0.7
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.
|
@@ -19,6 +19,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
19
19
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
20
20
|
const app_constants_1 = require("../constants/app-constants");
|
|
21
21
|
const ora_1 = __importDefault(require("ora"));
|
|
22
|
+
const acr_error_1 = __importDefault(require("../utils/acr-error"));
|
|
22
23
|
let COMPOSE_FILE = "";
|
|
23
24
|
const PROJECT = "zerothreat";
|
|
24
25
|
const NETWORK = "zerothreat-onprem-nw";
|
|
@@ -91,7 +92,7 @@ async function firstIgnition(licenseKey, emailId) {
|
|
|
91
92
|
console.log(">> Setting up application ...");
|
|
92
93
|
await ensureNetwork();
|
|
93
94
|
await pullImages();
|
|
94
|
-
await runCompose(["up", "-d"]);
|
|
95
|
+
await runCompose(["up", "-d", "--pull", "never"]);
|
|
95
96
|
//Wait for 10 minutes to allow sql server to start
|
|
96
97
|
const sqlContainerWaitSpinner = (0, ora_1.default)('Waiting for SQL Server to start...').start();
|
|
97
98
|
const SqlSuccess = await checkSqlSuccess();
|
|
@@ -181,7 +182,7 @@ async function updateSystemService() {
|
|
|
181
182
|
console.log(">> Setting up application ...");
|
|
182
183
|
await ensureNetwork();
|
|
183
184
|
await pullImages();
|
|
184
|
-
await runCompose(["up", "-d"]);
|
|
185
|
+
await runCompose(["up", "-d", "--pull", "never"]);
|
|
185
186
|
//Wait for 10 minutes to allow sql server to start
|
|
186
187
|
const sqlContainerWaitSpinner = (0, ora_1.default)('Waiting for SQL Server to start...').start();
|
|
187
188
|
const SqlSuccess = await checkSqlSuccess();
|
|
@@ -190,11 +191,16 @@ async function updateSystemService() {
|
|
|
190
191
|
throw new Error("Unable to complete database setup. Please try again later.");
|
|
191
192
|
}
|
|
192
193
|
sqlContainerWaitSpinner.succeed("connected to database.");
|
|
194
|
+
console.log(chalk_1.default.greenBright("\nZeroThreat updated successfully.\n"));
|
|
193
195
|
}
|
|
194
196
|
catch (error) {
|
|
195
197
|
if (spinner.isSpinning)
|
|
196
|
-
spinner.fail(chalk_1.default.red('Verification failed. Please check
|
|
197
|
-
|
|
198
|
+
spinner.fail(chalk_1.default.red('Verification failed. Please check details.'));
|
|
199
|
+
if (error instanceof acr_error_1.default) {
|
|
200
|
+
console.log(chalk_1.default.red(`Error : ${error.message}`));
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
throw new Error(chalk_1.default.red(error));
|
|
198
204
|
}
|
|
199
205
|
finally {
|
|
200
206
|
COMPOSE_FILE = "";
|
|
@@ -4,12 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.updateSystem = updateSystem;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const acr_error_1 = __importDefault(require("../utils/acr-error"));
|
|
9
9
|
const acr_token_service_1 = __importDefault(require("../services/acr-token-service"));
|
|
10
10
|
const app_constants_1 = require("../constants/app-constants");
|
|
11
11
|
const license_service_1 = require("../actions/license-service");
|
|
12
12
|
const general_api_1 = __importDefault(require("../services/general-api"));
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
13
14
|
const deleteAcr = async () => {
|
|
14
15
|
// Acr token Delete
|
|
15
16
|
const acrTokenService = new acr_token_service_1.default();
|
|
@@ -28,19 +29,19 @@ async function updateSystem() {
|
|
|
28
29
|
try {
|
|
29
30
|
await (0, license_service_1.updateSystemService)();
|
|
30
31
|
await completeProcess();
|
|
31
|
-
console.log(chalk_1.default.greenBright("\nZeroThreat updated successfully.\n"));
|
|
32
32
|
}
|
|
33
33
|
catch (err) {
|
|
34
|
-
if (err instanceof acr_error_1.default) {
|
|
35
|
-
console.log(chalk_1.default.red(`Error : ${err.message}`));
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
34
|
console.error(chalk_1.default.redBright(`Error : ${err.message}`));
|
|
39
35
|
console.error(chalk_1.default.yellowBright(`Please Retry.`));
|
|
40
36
|
return;
|
|
41
37
|
}
|
|
42
38
|
finally {
|
|
43
39
|
await deleteAcr();
|
|
40
|
+
if (app_constants_1.dockerComposeAcr) {
|
|
41
|
+
const tempDir = path_1.default.dirname(app_constants_1.dockerComposeAcr);
|
|
42
|
+
fs_1.default.rmSync(tempDir, { recursive: true, force: true });
|
|
43
|
+
(0, app_constants_1.setDockerComposeAcr)('');
|
|
44
|
+
}
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
;
|
|
@@ -5,7 +5,7 @@ const API_CONFIG = () => {
|
|
|
5
5
|
if (!process.env.WORKING_ENVIRONMENT) {
|
|
6
6
|
return {
|
|
7
7
|
licenseApi: `http://localhost:3201/api/license`,
|
|
8
|
-
onPremLicenseCloudeApi: `https://zt-
|
|
8
|
+
onPremLicenseCloudeApi: `https://zt-stage-app-containerapps.agreeablestone-ae5e635a.centralus.azurecontainerapps.io/api/on-prem/license`,
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
else {
|