feat(plugins): add plugins
This commit is contained in:
parent
d78cb874ed
commit
417ddf1ccf
|
@ -1,11 +1,27 @@
|
||||||
package mockplugin
|
package mockplugin
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
_ "net/http/pprof"
|
||||||
|
|
||||||
|
_ "gitee.com/timedb/wheatCache/conf"
|
||||||
|
"gitee.com/timedb/wheatCache/pkg/logx"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
)
|
||||||
|
|
||||||
type MockPlugin struct {
|
type MockPlugin struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MockPlugin) Init() {
|
func (m *MockPlugin) Init() {
|
||||||
|
addr := viper.GetString("mock-plugin.pprof-addr")
|
||||||
|
if addr != "" {
|
||||||
|
go func() {
|
||||||
|
logx.Debugln(http.ListenAndServe(addr, nil))
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
logx.Debug("mock-plugins status: start")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MockPlugin) Exec(msg interface{}) (interface{}, error) {
|
func (m *MockPlugin) Exec(msg interface{}) (interface{}, error) {
|
||||||
|
|
Loading…
Reference in New Issue