Some checks failed
Release Workflow / determine-release-type (push) Has been cancelled
Release Workflow / checks (push) Has been cancelled
Release Workflow / e2e-tests (push) Has been cancelled
Release Workflow / build-images (push) Has been cancelled
Release Workflow / publish-release (push) Has been cancelled
26 lines
574 B
TypeScript
26 lines
574 B
TypeScript
import * as schema from "../../db/schema";
|
|
import { runDbMigrations, setSchema } from "../../db/db";
|
|
import { runMigrations } from "./migrations";
|
|
import { startup } from "./startup";
|
|
|
|
let bootstrapPromise: Promise<void> | undefined;
|
|
|
|
const runBootstrap = async () => {
|
|
setSchema(schema);
|
|
runDbMigrations();
|
|
await runMigrations();
|
|
await startup();
|
|
};
|
|
|
|
export const bootstrapApplication = async () => {
|
|
if (!bootstrapPromise) {
|
|
bootstrapPromise = runBootstrap();
|
|
}
|
|
|
|
try {
|
|
await bootstrapPromise;
|
|
} catch (err) {
|
|
bootstrapPromise = undefined;
|
|
throw err;
|
|
}
|
|
};
|