️ feat: 在前端服务中添加端口映射,并在API客户端中记录后端URL

This commit is contained in:
2025-07-26 10:30:36 +08:00
parent b92fce5c7c
commit 7918f04059
3 changed files with 4 additions and 1 deletions

View File

@ -13,6 +13,8 @@ services:
networks: networks:
- internal-network - internal-network
restart: always restart: always
ports:
- "3000:3000"
volumes: volumes:
- .env.frontend:/app/.env.production:ro - .env.frontend:/app/.env.production:ro

View File

@ -21,7 +21,6 @@ const nextConfig: NextConfig = {
], ],
}, },
async rewrites() { async rewrites() {
console.log('Using development API base URL:', BACKEND_URL)
return [ return [
{ {
source: '/api/:path*', source: '/api/:path*',

View File

@ -3,6 +3,8 @@ import { camelToSnakeObj, snakeToCamelObj } from 'field-conv'
export const BACKEND_URL = process.env.BACKEND_URL || 'http://neo-blog-backend:8888' export const BACKEND_URL = process.env.BACKEND_URL || 'http://neo-blog-backend:8888'
console.info(`Using backend URL: ${BACKEND_URL}`)
const isServer = typeof window === 'undefined' const isServer = typeof window === 'undefined'
const API_SUFFIX = '/api/v1' const API_SUFFIX = '/api/v1'