server/database/datasource.ts

21 lines
643 B
TypeScript
Raw Normal View History

2023-11-27 02:40:44 +01:00
import { Queue } from "bullmq";
2023-09-11 05:31:08 +02:00
import { getConfig } from "../utils/config";
import { PrismaClient } from "@prisma/client";
2023-09-11 05:31:08 +02:00
const config = getConfig();
const client = new PrismaClient({
datasourceUrl: `postgresql://${config.database.username}:${config.database.password}@${config.database.host}:${config.database.port}/${config.database.database}`,
});
2023-11-27 02:40:44 +01:00
const federationQueue = new Queue("federation", {
connection: {
host: config.redis.queue.host,
2023-11-27 06:53:13 +01:00
port: Number(config.redis.queue.port),
password: config.redis.queue.password || undefined,
2023-11-27 06:30:57 +01:00
db: config.redis.queue.database || undefined,
2023-11-27 02:40:44 +01:00
},
});
export { client, federationQueue };