server/database/datasource.ts
2024-03-10 16:04:14 -10:00

21 lines
674 B
TypeScript

import { Queue } from "bullmq";
import { PrismaClient } from "@prisma/client";
import { ConfigManager } from "config-manager";
const config = await new ConfigManager({}).getConfig();
const client = new PrismaClient({
datasourceUrl: `postgresql://${config.database.username}:${config.database.password}@${config.database.host}:${config.database.port}/${config.database.database}`,
});
const federationQueue = new Queue("federation", {
connection: {
host: config.redis.queue.host,
port: Number(config.redis.queue.port),
password: config.redis.queue.password || undefined,
db: config.redis.queue.database || undefined,
},
});
export { client, federationQueue };