rename auth and start work separating config

This commit is contained in:
Milo Schwartz 2025-01-01 16:40:01 -05:00
parent d447de9e8a
commit b199595100
No known key found for this signature in database
15 changed files with 153 additions and 120 deletions

View file

@ -1,18 +1,23 @@
import { ensureActions } from "./ensureActions";
import { copyInConfig } from "./copyInConfig";
import logger from "@server/logger";
import { runMigrations } from "./migrations";
import { setupServerAdmin } from "./setupServerAdmin";
import { loadConfig } from "@server/config";
export async function runSetupFunctions() {
try {
logger.info(`Setup for version ${process.env.APP_VERSION}`);
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) {
logger.error("Error running setup functions", error);
console.error("Error running setup functions:", error);
process.exit(1);
}
}