From 8056837a5b3e33dd3cdd9b171e8d12632d6e91f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB?= Date: Thu, 22 Feb 2024 16:33:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E6=8E=89=20validi?= =?UTF-8?q?ty=5Fstart=20=E5=92=8C=20validity=5Fend=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=20v3=20=E7=89=88=E6=9C=AC=E4=B8=8D=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E6=AD=A4=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apisix/v3.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apisix/v3.js b/src/apisix/v3.js index e9e7786..226ee3f 100644 --- a/src/apisix/v3.js +++ b/src/apisix/v3.js @@ -43,11 +43,18 @@ async function sslList() { * @returns {Promise} */ async function setupSsl(id, data) { + // 过滤掉 validity_start 和 validity_end,因为 v3 版本不允许此数据 + const v3Data = Object.keys(data).reduce((acc, key) => { + if (key !== 'validity_start' && key !== 'validity_end') { + acc[key] = data[key]; + } + return acc; + }, {}); return axios.request({ method: 'PUT', headers: { 'X-API-KEY': config.apisix_token }, url: `${config.apisix_host}/apisix/admin/ssls/${id}`, - data + data: v3Data }) } From ff4b316cc04f5597c2629a22aafe616294d9df8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB?= Date: Thu, 22 Feb 2024 16:34:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E5=88=86=E5=8F=B7?= =?UTF-8?q?=EF=BC=8C=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apisix/v3.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/apisix/v3.js b/src/apisix/v3.js index 226ee3f..6566403 100644 --- a/src/apisix/v3.js +++ b/src/apisix/v3.js @@ -46,10 +46,11 @@ async function setupSsl(id, data) { // 过滤掉 validity_start 和 validity_end,因为 v3 版本不允许此数据 const v3Data = Object.keys(data).reduce((acc, key) => { if (key !== 'validity_start' && key !== 'validity_end') { - acc[key] = data[key]; + acc[key] = data[key] } - return acc; - }, {}); + return acc + }, {}) + return axios.request({ method: 'PUT', headers: { 'X-API-KEY': config.apisix_token },