// 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 { GadgetLog } from "@gadget/api";
const log = new GadgetLog({ 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;
