mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-04 10:05:53 +02:00
Add setup entrypoint
This commit is contained in:
parent
39a24c951c
commit
9988061058
4 changed files with 12 additions and 7 deletions
|
@ -1,13 +1,11 @@
|
|||
import { ensureActions } from "./db/ensureActions";
|
||||
import { createApiServer } from "./apiServer";
|
||||
import { createNextServer } from "./nextServer";
|
||||
import { createInternalServer } from "./internalServer";
|
||||
import { User, UserOrg } from "./db/schema";
|
||||
import { copyInConfig } from "./setup/copyInConfig";
|
||||
import { runSetupFunctions } from "./setup";
|
||||
|
||||
async function startServers() {
|
||||
await ensureActions();
|
||||
await copyInConfig();
|
||||
await runSetupFunctions();
|
||||
|
||||
// Start all servers
|
||||
const apiServer = createApiServer();
|
||||
|
|
|
@ -7,7 +7,7 @@ import response from "@server/utils/response";
|
|||
import HttpCode from "@server/types/HttpCode";
|
||||
import createHttpError from "http-errors";
|
||||
import logger from "@server/logger";
|
||||
import { createAdminRole } from "@server/db/ensureActions";
|
||||
import { createAdminRole } from "@server/setup/ensureActions";
|
||||
import config from "@server/config";
|
||||
import { fromError } from "zod-validation-error";
|
||||
import { defaultRoleAllowedActions } from "../role";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ActionsEnum } from "@server/auth/actions";
|
||||
import { db } from "@server/db";
|
||||
import { actions, roles, roleActions } from "./schema";
|
||||
import { eq, and, inArray, notInArray } from "drizzle-orm";
|
||||
import { actions, roles, roleActions } from "../db/schema";
|
||||
import { eq, inArray } from "drizzle-orm";
|
||||
import logger from "@server/logger";
|
||||
|
||||
export async function ensureActions() {
|
7
server/setup/index.ts
Normal file
7
server/setup/index.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { ensureActions } from "./ensureActions";
|
||||
import { copyInConfig } from "./copyInConfig";
|
||||
|
||||
export async function runSetupFunctions() {
|
||||
await ensureActions(); // make sure all of the actions are in the db and the roles
|
||||
await copyInConfig(); // copy in the config to the db as needed
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue