Merge branch 'main' into 4-27-app-deploy

This commit is contained in:
Stephen Zhou 2026-05-06 17:35:36 +08:00
commit 56b27611a8
No known key found for this signature in database
4 changed files with 12 additions and 5 deletions

View File

@ -28,7 +28,6 @@ HONO_PROXY_HOST=127.0.0.1
HONO_PROXY_PORT=
HONO_CONSOLE_API_PROXY_TARGET=
HONO_PUBLIC_API_PROXY_TARGET=
# Defaults to https://enterprise-platform-dev.dify.dev when empty.
HONO_ENTERPRISE_API_PROXY_TARGET=
# The API PREFIX for MARKETPLACE

View File

@ -1,6 +1,6 @@
export const DEV_PROXY_TARGETS = ['dify', 'enterprise'] as const
const DEV_PROXY_TARGETS = ['dify', 'enterprise'] as const
export type DevProxyTarget = typeof DEV_PROXY_TARGETS[number]
type DevProxyTarget = typeof DEV_PROXY_TARGETS[number]
type DevProxyConfigEnv = Partial<Record<
| 'HONO_PROXY_HOST'

View File

@ -34,7 +34,7 @@ describe('dev proxy server', () => {
// Assert
expect(targets.consoleApiTarget).toBe('https://console.example.com')
expect(targets.publicApiTarget).toBe('https://console.example.com')
expect(targets.enterpriseApiTarget).toBe('https://enterprise-platform-dev.dify.dev')
expect(targets.enterpriseApiTarget).toBeUndefined()
})
// Scenario: target paths should not be duplicated when the incoming route already includes them.

View File

@ -14,7 +14,11 @@ type DevProxyEnv = Partial<Record<
type DevProxyTargets = {
consoleApiTarget: string
publicApiTarget: string
<<<<<<< HEAD
enterpriseApiTarget: string
=======
enterpriseApiTarget?: string
>>>>>>> main
}
type DevProxyAppOptions = DevProxyTargets & {
@ -189,7 +193,6 @@ export const resolveDevProxyTargets = (env: DevProxyEnv = {}): DevProxyTargets =
const publicApiTarget = env.HONO_PUBLIC_API_PROXY_TARGET
|| consoleApiTarget
const enterpriseApiTarget = env.HONO_ENTERPRISE_API_PROXY_TARGET
|| DEFAULT_ENTERPRISE_PROXY_TARGET
return {
consoleApiTarget,
@ -236,7 +239,12 @@ export const createDevProxyApp = (options: DevProxyAppOptions) => {
applyCorsHeaders(context.res.headers, context.req.header('origin'))
})
<<<<<<< HEAD
registerProxyRoutes(app, ENTERPRISE_API_ROUTES, options.enterpriseApiTarget, fetchImpl)
=======
if (options.enterpriseApiTarget)
registerProxyRoutes(app, ENTERPRISE_API_ROUTES, options.enterpriseApiTarget, fetchImpl)
>>>>>>> main
registerProxyRoutes(app, CONSOLE_API_ROUTES, options.consoleApiTarget, fetchImpl)
registerProxyRoutes(app, PUBLIC_API_ROUTES, options.publicApiTarget, fetchImpl)