mirror of
https://github.com/fosrl/pangolin.git
synced 2025-05-13 05:40:38 +01:00
15 lines
No EOL
686 B
TypeScript
15 lines
No EOL
686 B
TypeScript
import { db } from "@server/db";
|
|
import { orgs } from "../db/schema";
|
|
import config from "@server/config";
|
|
import { ne } from "drizzle-orm";
|
|
import logger from "@server/logger";
|
|
|
|
export async function copyInConfig() {
|
|
// create a url from config.app.base_url and get the hostname
|
|
const domain = new URL(config.app.base_url).hostname;
|
|
|
|
// update the domain on all of the orgs where the domain is not equal to the new domain
|
|
// TODO: eventually each org could have a unique domain that we do not want to overwrite, so this will be unnecessary
|
|
await db.update(orgs).set({ domain }).where(ne(orgs.domain, domain));
|
|
logger.debug("Updated orgs with new domain");
|
|
} |