mirror of
https://github.com/alibaba/higress.git
synced 2026-03-07 10:00:48 +08:00
rm plugin id after use (#2070)
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm"
|
||||
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm/types"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/tidwall/sjson"
|
||||
|
||||
"github.com/alibaba/higress/plugins/wasm-go/pkg/log"
|
||||
"github.com/alibaba/higress/plugins/wasm-go/pkg/matcher"
|
||||
@@ -445,14 +446,15 @@ func (ctx *CommonPluginCtx[PluginConfig]) OnPluginStart(int) types.OnPluginStart
|
||||
if !gjson.ValidBytes(data) {
|
||||
ctx.vm.log.Warnf("the plugin configuration is not a valid json: %s", string(data))
|
||||
return types.OnPluginStartStatusFailed
|
||||
|
||||
}
|
||||
pluginID := gjson.GetBytes(data, PluginIDKey).String()
|
||||
if pluginID != "" {
|
||||
ctx.vm.log.ResetID(pluginID)
|
||||
data, _ = sjson.DeleteBytes([]byte(data), PluginIDKey)
|
||||
}
|
||||
jsonData = gjson.ParseBytes(data)
|
||||
}
|
||||
pluginID := jsonData.Get(PluginIDKey).String()
|
||||
if pluginID != "" {
|
||||
ctx.vm.log.ResetID(pluginID)
|
||||
}
|
||||
|
||||
var parseOverrideConfig func(gjson.Result, PluginConfig, *PluginConfig) error
|
||||
if ctx.vm.parseRuleConfig != nil {
|
||||
parseOverrideConfig = func(js gjson.Result, global PluginConfig, cfg *PluginConfig) error {
|
||||
|
||||
Reference in New Issue
Block a user