local mongourl fix

This commit is contained in:
2025-03-02 23:34:43 +01:00
parent 3621998d41
commit e3e57a5cb0
6 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
import { NextResponse, NextRequest } from 'next/server'; import { NextResponse, NextRequest } from 'next/server';
import database from '../database'; import database from '../../../lib/database';
// Account creation // Account creation
// Email doesn't exist // Email doesn't exist
+2 -2
View File
@@ -1,8 +1,8 @@
import { TwitterApi } from 'twitter-api-v2'; import { TwitterApi } from 'twitter-api-v2';
import config from '@/app/api/env'; import config from '@/lib/config';
import { inspect } from 'util'; import { inspect } from 'util';
import { Post } from '@/utils'; import { Post } from '@/utils';
import database from '../database'; import database from '../../../lib/database';
import { format } from 'date-fns'; import { format } from 'date-fns';
import cron from 'node-cron'; import cron from 'node-cron';
import { ObjectId } from 'mongodb'; import { ObjectId } from 'mongodb';
+1 -1
View File
@@ -1,5 +1,5 @@
import { NextResponse, NextRequest } from 'next/server'; import { NextResponse, NextRequest } from 'next/server';
import database from '../database'; import database from '../../../lib/database';
import { PostRequest, ScheduleRequest } from '@/utils'; import { PostRequest, ScheduleRequest } from '@/utils';
import post from './post'; import post from './post';
import { ObjectId } from 'mongodb'; import { ObjectId } from 'mongodb';
+1 -1
View File
@@ -1,5 +1,5 @@
import { NextResponse, NextRequest } from 'next/server'; import { NextResponse, NextRequest } from 'next/server';
import database from '../database'; import database from '../../../lib/database';
import { ObjectId } from 'mongodb'; import { ObjectId } from 'mongodb';
export async function GET(req: NextRequest) { export async function GET(req: NextRequest) {
+6 -1
View File
@@ -1,3 +1,6 @@
// import dotenv from 'dotenv';
// dotenv.config();
function error(name: string): string { function error(name: string): string {
throw `'${name}' not found in '.env'`; throw `'${name}' not found in '.env'`;
} }
@@ -8,7 +11,9 @@ const config = {
secret: process.env.TWITTER_SECRET || error('TWITTER_SECRET'), secret: process.env.TWITTER_SECRET || error('TWITTER_SECRET'),
}, },
mongoUrl: process.env.MONGO_URL || error('MONGO_URL'), mongoUrl: process.env.MONGO || error('MONGO'),
}; };
console.log(process.env.MONGO);
export default config; export default config;
@@ -1,5 +1,5 @@
import { MongoClient } from 'mongodb'; import { MongoClient } from 'mongodb';
import config from './env'; import config from './config';
import { Schedule, Session, User } from '@/utils'; import { Schedule, Session, User } from '@/utils';
const client = new MongoClient(config.mongoUrl); const client = new MongoClient(config.mongoUrl);