fosrl.pangolin/server/setup/index.ts

24 lines
808 B
TypeScript
Raw Normal View History

2024-12-22 12:33:49 -05:00
import { ensureActions } from "./ensureActions";
import { copyInConfig } from "./copyInConfig";
2024-12-25 15:49:35 -05:00
import { runMigrations } from "./migrations";
import { setupServerAdmin } from "./setupServerAdmin";
import { loadConfig } from "@server/config";
2024-12-22 12:33:49 -05:00
export async function runSetupFunctions() {
2024-12-25 15:54:32 -05:00
try {
await runMigrations(); // run the migrations
console.log("Migrations completed successfully.")
// ANYTHING BEFORE THIS LINE CANNOT USE THE CONFIG
loadConfig();
2024-12-25 15:54:32 -05:00
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);
2024-12-25 15:54:32 -05:00
process.exit(1);
}
}