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 logger from "@server/logger";
|
|
|
|
import { runMigrations } from "./migrations";
|
2024-12-25 15:58:46 -05:00
|
|
|
import { setupServerAdmin } from "./setupServerAdmin";
|
2024-12-22 12:33:49 -05:00
|
|
|
|
|
|
|
export async function runSetupFunctions() {
|
2024-12-25 15:54:32 -05:00
|
|
|
try {
|
2024-12-25 15:58:46 -05:00
|
|
|
logger.info(`Setup for version ${process.env.APP_VERSION}`);
|
|
|
|
await runMigrations(); // run the migrations
|
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) {
|
|
|
|
logger.error("Error running setup functions", error);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
}
|