make config class and separate migrations script

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

View file

@ -1,23 +1,15 @@
import { ensureActions } from "./ensureActions";
import { copyInConfig } from "./copyInConfig";
import { runMigrations } from "./migrations";
import { setupServerAdmin } from "./setupServerAdmin";
import { loadConfig } from "@server/config";
import logger from "@server/logger";
export async function runSetupFunctions() {
try {
await runMigrations(); // run the migrations
console.log("Migrations completed successfully.")
// ANYTHING BEFORE THIS LINE CANNOT USE THE CONFIG
loadConfig();
await copyInConfig(); // copy in the config to the db as needed
await setupServerAdmin();
await ensureActions(); // make sure all of the actions are in the db and the roles
} catch (error) {
console.error("Error running setup functions:", error);
logger.error("Error running setup functions:", error);
process.exit(1);
}
}