From 6cad8a30a1a89f645e02e0663ccf8832dfe87047 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Thu, 21 Dec 2023 14:29:19 -0800 Subject: [PATCH] update boot script --- backend/models/organization.js | 4 +-- backend/utils/boot/index.js | 51 +--------------------------------- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/backend/models/organization.js b/backend/models/organization.js index 2637d549..4fb80751 100644 --- a/backend/models/organization.js +++ b/backend/models/organization.js @@ -17,9 +17,9 @@ const Organization = { message: "No Organization name provided.", }; - // If the new name contains bad characters + // If the new name contains bad characters // replace them with spaces and continue creation. - const newOrgName = orgName.replace(/[:\.,<>@]/g, ' '); + const newOrgName = orgName.replace(/[:\.,<>@]/g, " "); var slug = slugify(newOrgName, { lower: true }); const existingBySlug = await this.get({ slug }); diff --git a/backend/utils/boot/index.js b/backend/utils/boot/index.js index 02d4703a..4adfba95 100644 --- a/backend/utils/boot/index.js +++ b/backend/utils/boot/index.js @@ -1,45 +1,11 @@ process.env.NODE_ENV === "development" ? require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` }) : require("dotenv").config(); -const { DocumentVectors } = require("../../models/documentVectors"); -const { Organization } = require("../../models/organization"); -const { OrganizationApiKey } = require("../../models/organizationApiKey"); -const { - OrganizationConnection, -} = require("../../models/organizationConnection"); -const { OrganizationUser } = require("../../models/organizationUser"); -const { OrganizationWorkspace } = require("../../models/organizationWorkspace"); -const { Queue } = require("../../models/queue"); -const { SystemSettings } = require("../../models/systemSettings"); + const { Telemetry } = require("../../models/telemetry"); const { User } = require("../../models/user"); -const { WorkspaceDocument } = require("../../models/workspaceDocument"); const { getGitVersion } = require("../metrics"); -// function findOrCreateDBFile() { -// const fs = require("fs"); -// const path = require("path"); -// const storageFolder = path.resolve(__dirname, `../../storage/`); -// const dbPath = `${storageFolder}/vdbms.db`; -// if (!fs.existsSync(storageFolder)) fs.mkdirSync(storageFolder); -// if (fs.existsSync(dbPath)) return; -// fs.writeFileSync(dbPath, ""); -// console.log("SQLite db created on boot."); -// return; -// } - -// function findOrCreateJobDBFile() { -// const path = require("path"); -// const fs = require("fs"); -// const storageFolder = path.resolve(__dirname, `../../storage/`); -// const dbPath = `${storageFolder}/job_queue.db`; -// if (!fs.existsSync(storageFolder)) fs.mkdirSync(storageFolder); -// if (fs.existsSync(dbPath)) return; -// fs.writeFileSync(dbPath, ""); -// console.log("SQLite jobs db created on boot."); -// return; -// } - function setupVectorCacheStorage() { const fs = require("fs"); const path = require("path"); @@ -50,21 +16,6 @@ function setupVectorCacheStorage() { return; } -// Init all tables so to not try to reference foreign key -// tables that may not exist and also have their schema available. -// async function initTables() { -// (await SystemSettings.db()).close(); -// (await User.db()).close(); -// (await Organization.db()).close(); -// (await OrganizationApiKey.db()).close(); -// (await OrganizationConnection.db()).close(); -// (await OrganizationUser.db()).close(); -// (await OrganizationWorkspace.db()).close(); -// (await WorkspaceDocument.db()).close(); -// (await DocumentVectors.db()).close(); -// (await Queue.db()).close(); -// } - // Telemetry is anonymized and your data is never read. This can be disabled by setting // DISABLE_TELEMETRY=true in the `.env` of however you setup. Telemetry helps us determine use // of how VectorAdmin is used and how to improve this product!