mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-04 01:55:10 +02:00
make config class and separate migrations script
This commit is contained in:
parent
b199595100
commit
9732098799
45 changed files with 163 additions and 156 deletions
|
@ -11,7 +11,6 @@ import { createAdminRole } from "@server/setup/ensureActions";
|
|||
import config from "@server/config";
|
||||
import { fromError } from "zod-validation-error";
|
||||
import { defaultRoleAllowedActions } from "../role";
|
||||
import { extractBaseDomain } from "@server/utils/extractBaseDomain";
|
||||
|
||||
const createOrgSchema = z
|
||||
.object({
|
||||
|
@ -30,7 +29,7 @@ export async function createOrg(
|
|||
): Promise<any> {
|
||||
try {
|
||||
// should this be in a middleware?
|
||||
if (config.flags?.disable_user_create_org) {
|
||||
if (config.getRawConfig().flags?.disable_user_create_org) {
|
||||
if (!req.user?.serverAdmin) {
|
||||
return next(
|
||||
createHttpError(
|
||||
|
@ -83,8 +82,8 @@ export async function createOrg(
|
|||
let org: Org | null = null;
|
||||
|
||||
await db.transaction(async (trx) => {
|
||||
// create a url from config.app.base_url and get the hostname
|
||||
const domain = extractBaseDomain(config.app.base_url);
|
||||
// create a url from config.getRawConfig().app.base_url and get the hostname
|
||||
const domain = config.getBaseDomain();
|
||||
|
||||
const newOrg = await trx
|
||||
.insert(orgs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue