File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ SERVER_PORT=20000
2121YUNYU_WEB_IMAGE = ghcr.io/idea-flow/yunyu-web:latest
2222# SSR 服务端调用后端的内部地址(容器内网),默认已指向 yunyu-server-native:20000,通常无需修改
2323# 仅在自定义容器名或网络时才需要覆盖
24- YUNYU_API_BASE_INTERNAL = http://yunyu-server-native:20000
24+ NUXT_YUNYU_API_BASE_INTERNAL = http://yunyu-server-native:20000
2525# 浏览器端 API 地址:纯 Docker 模式下前后端同域,浏览器通过 nginx 转发 /api/*,留空即可
2626# 若需要跨域访问后端,填写后端完整域名,如:https://api.yourdomain.com
2727YUNYU_PUBLIC_API_BASE =
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ services:
5353 - yunyu-server-native
5454 environment :
5555 # SSR 服务端调用后端使用容器名(内部网络),浏览器端 API 请求经 nginx 同域转发,无需单独配置
56- YUNYU_API_BASE_INTERNAL : ${YUNYU_API_BASE_INTERNAL :-http://yunyu-server-native:20000}
56+ NUXT_YUNYU_API_BASE_INTERNAL : ${NUXT_YUNYU_API_BASE_INTERNAL :-http://yunyu-server-native:20000}
5757 NUXT_PUBLIC_API_BASE : ${YUNYU_PUBLIC_API_BASE:-}
5858 TZ : ${TZ:-Asia/Shanghai}
5959 # 不对外暴露端口,只在内部网络中被 nginx 访问
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ export function useApiClient() {
2828 * SSR 阶段优先使用容器内网地址(apiBaseInternal),浏览器端使用 public.apiBase(留空则走 nginx 同域转发)。
2929 */
3030 function resolveApiBase ( ) {
31- if ( import . meta. server && config . apiBaseInternal ) {
32- return config . apiBaseInternal
31+ if ( import . meta. server && config . yunyuApiBaseInternal ) {
32+ return config . yunyuApiBaseInternal
3333 }
3434 return config . public . apiBase
3535 }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export default defineNuxtConfig({
2222 css : [ 'katex/dist/katex.min.css' , '~/assets/css/main.css' ] ,
2323 runtimeConfig : {
2424 // 仅服务端可见:SSR 阶段调用后端使用容器内部地址,避免走 nginx 或公网
25- apiBaseInternal : process . env . YUNYU_API_BASE_INTERNAL || '' ,
25+ yunyuApiBaseInternal : process . env . NUXT_YUNYU_API_BASE_INTERNAL || '' ,
2626 public : {
2727 // 浏览器端使用:留空时请求走相对路径,由 nginx 同域转发到后端
2828 apiBase : process . env . YUNYU_PUBLIC_API_BASE || ''
Original file line number Diff line number Diff line change 55export default defineEventHandler ( ( event ) => {
66 const config = useRuntimeConfig ( event )
77
8- const apiBaseInternal = config . apiBaseInternal || ''
8+ const apiBaseInternal = config . yunyuApiBaseInternal || ''
99 const apiBasePublic = config . public . apiBase || ''
1010 const resolvedApiBase = apiBaseInternal || apiBasePublic
1111
You can’t perform that action at this time.
0 commit comments