config 动态加载进来了的,没法初始化的加载进去,麻烦,直接传递过来
This commit is contained in:
parent
65ddbab658
commit
622a368a25
|
@ -11,7 +11,7 @@ func Order(ctx context.Context, tag string, request *proto.OrderRequest) (*proto
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
request.Config = srv.Config
|
//request.Config = srv.Config
|
||||||
return srv.Impl.Order(ctx, request)
|
return srv.Impl.Order(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ func Query(ctx context.Context, tag string, request *proto.QueryRequest) (*proto
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
request.Config = srv.Config
|
|
||||||
return srv.Impl.Query(ctx, request)
|
return srv.Impl.Query(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +28,5 @@ func Notify(ctx context.Context, tag string, request *proto.NotifyRequest) (*pro
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
request.Config = srv.Config
|
|
||||||
return srv.Impl.Notify(ctx, request)
|
return srv.Impl.Notify(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
|
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
|
@ -20,7 +19,7 @@ type Config struct {
|
||||||
Timeout time.Duration // 插件超时时间
|
Timeout time.Duration // 插件超时时间
|
||||||
|
|
||||||
// 供应商配置
|
// 供应商配置
|
||||||
Config json.RawMessage
|
// Config json.RawMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) Validate() error {
|
func (c *Config) Validate() error {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
|
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
|
||||||
)
|
)
|
||||||
|
@ -9,7 +8,7 @@ import (
|
||||||
type PluginInfo struct {
|
type PluginInfo struct {
|
||||||
Tag string
|
Tag string
|
||||||
Impl shared.PluginService
|
Impl shared.PluginService
|
||||||
Config json.RawMessage
|
//Config json.RawMessage
|
||||||
cleanup func()
|
cleanup func()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +35,7 @@ func (m *pluginManage) add(c *Config) error {
|
||||||
m.plugins[c.Tag] = &PluginInfo{
|
m.plugins[c.Tag] = &PluginInfo{
|
||||||
Tag: c.Tag,
|
Tag: c.Tag,
|
||||||
Impl: impl,
|
Impl: impl,
|
||||||
Config: c.Config,
|
//Config: c.Config,
|
||||||
cleanup: cleanup,
|
cleanup: cleanup,
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue