Skip to content

Commit

Permalink
update boot script
Browse files Browse the repository at this point in the history
timothycarambat committed Dec 21, 2023
1 parent 0f13205 commit 6cad8a3
Showing 2 changed files with 3 additions and 52 deletions.
4 changes: 2 additions & 2 deletions backend/models/organization.js
Original file line number Diff line number Diff line change
@@ -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 });
51 changes: 1 addition & 50 deletions backend/utils/boot/index.js
Original file line number Diff line number Diff line change
@@ -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!

0 comments on commit 6cad8a3

Please sign in to comment.