From 0ba63e5dd48dad6e4a2cd9a077abb6aca32b65c1 Mon Sep 17 00:00:00 2001 From: mirror <674958229@qq.com> Date: Fri, 13 Dec 2024 19:03:26 +0800 Subject: [PATCH] fix: default port of static service in ai-cache plugin (#1591) --- plugins/wasm-go/extensions/ai-cache/cache/provider.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/wasm-go/extensions/ai-cache/cache/provider.go b/plugins/wasm-go/extensions/ai-cache/cache/provider.go index 1238d2157..d68acd509 100644 --- a/plugins/wasm-go/extensions/ai-cache/cache/provider.go +++ b/plugins/wasm-go/extensions/ai-cache/cache/provider.go @@ -2,6 +2,7 @@ package cache import ( "errors" + "strings" "github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper" "github.com/tidwall/gjson" @@ -62,7 +63,12 @@ func (c *ProviderConfig) FromJson(json gjson.Result) { c.serviceName = json.Get("serviceName").String() c.servicePort = int(json.Get("servicePort").Int()) if !json.Get("servicePort").Exists() { - c.servicePort = 6379 + if strings.HasSuffix(c.serviceName, ".static") { + // use default logic port which is 80 for static service + c.servicePort = 80 + } else { + c.servicePort = 6379 + } } c.serviceHost = json.Get("serviceHost").String() c.username = json.Get("username").String()