2023-12-28 06:21:37 -05:00
|
|
|
import mongoose from "mongoose";
|
2023-10-12 23:04:25 -04:00
|
|
|
const FUCKYOU = "/rockfic/abc-rockfic-v3";
|
2024-03-16 21:21:46 -04:00
|
|
|
// dotenv.config({ path: resolve("/home/rockfic/rockfic-staging/.env") });
|
|
|
|
export const hasMigrated = true;
|
2023-10-12 23:04:25 -04:00
|
|
|
export const uri =
|
2024-03-16 21:21:46 -04:00
|
|
|
process.env.NODE_ENV === "production" && !process.env.TEST
|
2024-01-06 20:37:11 -05:00
|
|
|
? `mongodb://${process.env.DBUSER}:${process.env.DBPASS}@${process.env.DB}?authSource=admin`
|
2024-03-16 21:21:46 -04:00
|
|
|
: `mongodb://127.0.0.1/${process.env.DBNAME}`;
|
2023-10-12 23:04:25 -04:00
|
|
|
export const olduri =
|
2024-03-16 21:21:46 -04:00
|
|
|
process.env.NODE_ENV === "production" && !process.env.TEST
|
2024-01-06 20:37:11 -05:00
|
|
|
? `mongodb://${process.env.DBUSER}:${process.env.DBPASS}@127.0.0.1:27017/rockfic_old?authSource=admin`
|
|
|
|
: `mongodb://127.0.0.1/rockfic_old?authSource=admin`;
|
2023-12-28 06:21:37 -05:00
|
|
|
|
2023-12-30 15:58:14 -05:00
|
|
|
!mongoose.connection.modelNames().length && !hasMigrated && mongoose.connect(uri);
|