delpoyment with fully dockerized project on wixur.ir, dyolink docker hub created beside backend and frontend image is uploaded.
This commit is contained in:
@@ -3,16 +3,15 @@ import { PrismaClient } from '@prisma/client';
|
||||
import { config } from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
// Load environment variables from the correct path
|
||||
const envPath = path.join(__dirname, '..', '.env');
|
||||
console.log('Loading .env from:', envPath);
|
||||
config({ path: envPath });
|
||||
// Load .env when running locally; Docker injects DATABASE_URL via env_file.
|
||||
if (!process.env.DATABASE_URL) {
|
||||
const envPath = path.join(__dirname, '..', '.env');
|
||||
console.log('Loading .env from:', envPath);
|
||||
config({ path: envPath });
|
||||
}
|
||||
|
||||
// Verify DATABASE_URL is loaded
|
||||
if (!process.env.DATABASE_URL) {
|
||||
console.error('❌ DATABASE_URL is not set in environment');
|
||||
console.log('Current directory:', process.cwd());
|
||||
console.log('.env path:', envPath);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user