// src/lib/db.ts
// Copyright (C) 2026 Robert Colbert <rob.colbert@openplatform.us>
// All Rights Reserved

import env from "../config/env.js";

import mongoose from "mongoose";

import { DtpLog } from "./log.js";
const log = new DtpLog({ name: "db", slug: "db" });

const DB_URL = `mongodb://${env.mongodb.host}/${env.mongodb.database}`;

log.info("connecting to MongoDB", DB_URL);
export const db = mongoose.connect(DB_URL);

export default db;
