mirror of
https://github.com/MatrixSeven/file-transfer-go.git
synced 2026-03-12 11:07:46 +08:00
feat:环境变量处理
This commit is contained in:
40
chuan-next/next.config.js
Normal file
40
chuan-next/next.config.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
// 环境变量配置
|
||||
env: {
|
||||
GO_BACKEND_URL: process.env.GO_BACKEND_URL,
|
||||
},
|
||||
|
||||
// 公共运行时配置
|
||||
publicRuntimeConfig: {
|
||||
apiBaseUrl: process.env.NEXT_PUBLIC_API_BASE_URL,
|
||||
wsUrl: process.env.NEXT_PUBLIC_WS_URL,
|
||||
},
|
||||
|
||||
// 服务器端运行时配置
|
||||
serverRuntimeConfig: {
|
||||
goBackendUrl: process.env.GO_BACKEND_URL,
|
||||
},
|
||||
|
||||
// 重写规则 - 可选,用于代理API请求
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: '/api/proxy/:path*',
|
||||
destination: `${process.env.GO_BACKEND_URL}/api/:path*`,
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
// 输出配置
|
||||
output: 'standalone',
|
||||
|
||||
// 实验性功能
|
||||
experimental: {
|
||||
serverActions: {
|
||||
allowedOrigins: ['localhost:3000', 'localhost:8080'],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = nextConfig
|
||||
Reference in New Issue
Block a user