make config class and separate migrations script

This commit is contained in:
Milo Schwartz
2025-01-01 17:50:12 -05:00
parent b199595100
commit 9732098799
45 changed files with 163 additions and 156 deletions

View File

@@ -1,11 +0,0 @@
export function extractBaseDomain(url: string): string {
const newUrl = new URL(url);
const hostname = newUrl.hostname;
const parts = hostname.split(".");
if (parts.length <= 2) {
return parts.join(".");
}
return parts.slice(1).join(".");
}

View File

@@ -0,0 +1,16 @@
import path from "path";
import { __DIRNAME } from "@server/consts";
import fs from "fs";
export function loadAppVersion() {
const packageJsonPath = path.join(__DIRNAME, "..", "package.json");
let packageJson: any;
if (fs.existsSync && fs.existsSync(packageJsonPath)) {
const packageJsonContent = fs.readFileSync(packageJsonPath, "utf8");
packageJson = JSON.parse(packageJsonContent);
if (packageJson.version) {
return packageJson.version;
}
}
}