mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 04:37:31 +08:00
support nil option in NewCommonVmCtx (#1909)
This commit is contained in:
@@ -258,7 +258,13 @@ func parseEmptyPluginConfig[PluginConfig any](gjson.Result, *PluginConfig, Log)
|
|||||||
|
|
||||||
func NewCommonVmCtx[PluginConfig any](pluginName string, options ...CtxOption[PluginConfig]) *CommonVmCtx[PluginConfig] {
|
func NewCommonVmCtx[PluginConfig any](pluginName string, options ...CtxOption[PluginConfig]) *CommonVmCtx[PluginConfig] {
|
||||||
logger := &DefaultLog{pluginName, "nil"}
|
logger := &DefaultLog{pluginName, "nil"}
|
||||||
opts := append([]CtxOption[PluginConfig]{WithLogger[PluginConfig](logger)}, options...)
|
opts := []CtxOption[PluginConfig]{WithLogger[PluginConfig](logger)}
|
||||||
|
for _, opt := range options {
|
||||||
|
if opt == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
opts = append(opts, opt)
|
||||||
|
}
|
||||||
return NewCommonVmCtxWithOptions(pluginName, opts...)
|
return NewCommonVmCtxWithOptions(pluginName, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user