mirror of
https://github.com/patdelphi/suanming.git
synced 2026-02-27 21:23:12 +08:00
Fix production environment detection for Koyeb deployment
- Add fallback detection using PORT=8000 for Koyeb - Add environment debugging logs - Ensure static file serving is enabled in production - Fix NODE_ENV detection issues in containerized deployment
This commit is contained in:
@@ -94,7 +94,13 @@ app.use('/api/history', historyRoutes);
|
||||
app.use('/api/profile', profileRoutes);
|
||||
|
||||
// 静态文件服务 (用于生产环境)
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// 强制在 Koyeb 部署时启用静态文件服务
|
||||
const isProduction = process.env.NODE_ENV === 'production' || process.env.PORT === '8000';
|
||||
console.log('当前环境:', process.env.NODE_ENV);
|
||||
console.log('端口:', process.env.PORT);
|
||||
console.log('是否为生产环境:', isProduction);
|
||||
|
||||
if (isProduction) {
|
||||
const distPath = path.join(__dirname, '../dist');
|
||||
const indexPath = path.join(distPath, 'index.html');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user