61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
// =====================================================
|
|
// 檢查環境變數載入情況
|
|
// =====================================================
|
|
|
|
console.log('🔍 檢查環境變數載入情況...\n');
|
|
|
|
// 檢查所有相關的環境變數
|
|
const envVars = [
|
|
'DB_HOST',
|
|
'DB_PORT',
|
|
'DB_NAME',
|
|
'DB_USER',
|
|
'DB_PASSWORD',
|
|
'SLAVE_DB_HOST',
|
|
'SLAVE_DB_PORT',
|
|
'SLAVE_DB_NAME',
|
|
'SLAVE_DB_USER',
|
|
'SLAVE_DB_PASSWORD',
|
|
'DB_DUAL_WRITE_ENABLED',
|
|
'DB_MASTER_PRIORITY'
|
|
];
|
|
|
|
console.log('📋 環境變數檢查結果:');
|
|
console.log('='.repeat(50));
|
|
|
|
envVars.forEach(varName => {
|
|
const value = process.env[varName];
|
|
if (value) {
|
|
console.log(`✅ ${varName}: ${value}`);
|
|
} else {
|
|
console.log(`❌ ${varName}: undefined`);
|
|
}
|
|
});
|
|
|
|
console.log('\n🔍 檢查 .env 文件是否存在...');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const envPath = path.join(__dirname, '..', '.env');
|
|
if (fs.existsSync(envPath)) {
|
|
console.log('✅ .env 文件存在');
|
|
console.log('📄 .env 文件內容:');
|
|
console.log('-'.repeat(30));
|
|
const envContent = fs.readFileSync(envPath, 'utf8');
|
|
console.log(envContent);
|
|
} else {
|
|
console.log('❌ .env 文件不存在');
|
|
}
|
|
|
|
console.log('\n🔍 檢查 Next.js 配置...');
|
|
const nextConfigPath = path.join(__dirname, '..', 'next.config.mjs');
|
|
if (fs.existsSync(nextConfigPath)) {
|
|
console.log('✅ next.config.mjs 存在');
|
|
const nextConfig = fs.readFileSync(nextConfigPath, 'utf8');
|
|
console.log('📄 Next.js 配置內容:');
|
|
console.log('-'.repeat(30));
|
|
console.log(nextConfig);
|
|
} else {
|
|
console.log('❌ next.config.mjs 不存在');
|
|
}
|