From cc131d28f875c0fbc6a104127d3d6fbeb74b2c4b Mon Sep 17 00:00:00 2001 From: Xiaoyan Rao <270668624@qq.com> Date: Sun, 29 Sep 2024 15:29:50 +0800 Subject: [PATCH 1/2] feat(gu): added proxy Admin API. --- src/config.ts | 13 +++++-------- vite.config.ts | 5 +++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/config.ts b/src/config.ts index 3bad4e9..6f802ae 100644 --- a/src/config.ts +++ b/src/config.ts @@ -38,18 +38,15 @@ export const config = { }, get ADMIN_API_URL() { - const ADMIN_API_URL = getConfig('ADMIN_API_URL', null) + const ADMIN_API_URL = getConfig('ADMIN_API_URL', '') + if (ADMIN_API_URL) { - return /^(https?:)?\/\//.test(ADMIN_API_URL) - ? ADMIN_API_URL - : `${window.location.protocol}//${ADMIN_API_URL}` + return /^(https?:)?\/\//.test(ADMIN_API_URL) ? ADMIN_API_URL : `${window.location.protocol}//${ADMIN_API_URL}` } - const port = window.location.protocol.toLowerCase() === 'https:' - ? config.ADMIN_API_SSL_PORT - : config.ADMIN_API_PORT + const baseUrl = `${window.location.protocol}//${window.location.hostname}:${window.location.port}` - return `${window.location.protocol}//${window.location.hostname}:${port}` + return `${baseUrl}${config.ADMIN_GUI_PATH === '/' ? '' : config.ADMIN_GUI_PATH}/gateway/api` }, get ANONYMOUS_REPORTS() { diff --git a/vite.config.ts b/vite.config.ts index 4e68e80..7e7e932 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -48,6 +48,11 @@ export default defineConfig({ server: { proxy: { '/kconfig.js': process.env.KONG_GUI_URL || 'http://127.0.0.1:8002', + '/gateway/api': { + target: process.env.KONG_GUI_API_URL || 'http://127.0.0.1:8001', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/gateway\/api/, ''), + }, }, port: 8080, }, From 471c75e33563a99c290351045f87146f487d67f7 Mon Sep 17 00:00:00 2001 From: Xiaoyan Rao <270668624@qq.com> Date: Sun, 29 Sep 2024 16:52:52 +0800 Subject: [PATCH 2/2] only for test --- .github/actions/select-gateway-image/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/select-gateway-image/action.yml b/.github/actions/select-gateway-image/action.yml index d9122b6..e141036 100644 --- a/.github/actions/select-gateway-image/action.yml +++ b/.github/actions/select-gateway-image/action.yml @@ -20,7 +20,7 @@ runs: shell: bash env: DEFAULT_GATEWAY_IMAGE: |- - ${{ format('{0}', inputs.enterprise) == 'true' && 'kong/kong-gateway-internal:nightly-ubuntu' || 'kong/kong:master-ubuntu' }} + ${{ format('{0}', inputs.enterprise) == 'true' && 'kong/kong-gateway-internal:nightly-ubuntu' || 'kong/kong:pr-13647-ubuntu' }} run: | GATEWAY_IMAGE="${{ inputs.current-image }}"