支持 .env 配置,并完善源头对接文档与测试订单

- 增加 .env.example 与 godotenv 加载,start.sh 自动读环境变量
- 重写发给源头的开放接口对接文档
- 订单页支持创建测试订单(可直接已支付并复制店铺订单号)
This commit is contained in:
yml2213
2026-07-20 16:19:57 +08:00
parent 89cdd32181
commit e4d0a71963
13 changed files with 504 additions and 215 deletions
+21 -14
View File
@@ -1,19 +1,26 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
},
'/health': {
target: 'http://localhost:8080',
changeOrigin: true,
export default defineConfig(({ mode }) => {
// 读取 frontend/.env* 与进程环境(start.sh 会注入根目录 .env
const env = loadEnv(mode, process.cwd(), '')
const apiTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:8080'
const port = Number(env.PORT || env.FRONTEND_PORT || 5173)
return {
plugins: [react()],
server: {
port,
proxy: {
'/api': {
target: apiTarget,
changeOrigin: true,
},
'/health': {
target: apiTarget,
changeOrigin: true,
},
},
},
},
}
})