config 动态加载进来了的,没法初始化的加载进去,麻烦,直接传递过来

This commit is contained in:
李子铭 2024-08-07 16:41:37 +08:00
parent 65ddbab658
commit 622a368a25
3 changed files with 8 additions and 12 deletions

View File

@ -11,7 +11,7 @@ func Order(ctx context.Context, tag string, request *proto.OrderRequest) (*proto
if err != nil {
return nil, err
}
request.Config = srv.Config
//request.Config = srv.Config
return srv.Impl.Order(ctx, request)
}
@ -20,7 +20,6 @@ func Query(ctx context.Context, tag string, request *proto.QueryRequest) (*proto
if err != nil {
return nil, err
}
request.Config = srv.Config
return srv.Impl.Query(ctx, request)
}
@ -29,6 +28,5 @@ func Notify(ctx context.Context, tag string, request *proto.NotifyRequest) (*pro
if err != nil {
return nil, err
}
request.Config = srv.Config
return srv.Impl.Notify(ctx, request)
}

View File

@ -1,7 +1,6 @@
package manage
import (
"encoding/json"
"fmt"
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
"github.com/go-playground/validator/v10"
@ -20,7 +19,7 @@ type Config struct {
Timeout time.Duration // 插件超时时间
// 供应商配置
Config json.RawMessage
// Config json.RawMessage
}
func (c *Config) Validate() error {

View File

@ -1,15 +1,14 @@
package manage
import (
"encoding/json"
"fmt"
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
)
type PluginInfo struct {
Tag string
Impl shared.PluginService
Config json.RawMessage
Tag string
Impl shared.PluginService
//Config json.RawMessage
cleanup func()
}
@ -34,9 +33,9 @@ func (m *pluginManage) add(c *Config) error {
return err
}
m.plugins[c.Tag] = &PluginInfo{
Tag: c.Tag,
Impl: impl,
Config: c.Config,
Tag: c.Tag,
Impl: impl,
//Config: c.Config,
cleanup: cleanup,
}
return nil