-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathplugin.go
51 lines (37 loc) · 862 Bytes
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gfnacos
import (
"fmt"
"github.com/gogf/gf/net/ghttp"
)
type ConfigListener func(config string)
var configListener ConfigListener = func(config string) {
}
type GfNacosPlugin struct {
Listener ConfigListener
}
func (gn GfNacosPlugin)Name()string{
return "gf-nacos"
}
func (gn GfNacosPlugin)Author()string{
return "github.com/imloama"
}
func (gn GfNacosPlugin)Version()string{
return Version
}
func (gn GfNacosPlugin)Description()string{
return "goframe and nacos"
}
func (gn GfNacosPlugin)Install(s *ghttp.Server)error{
fmt.Println("gf-nacos插件正在安装...")
configListener = gn.Listener
//fmt.Printf("configListener: %s", configListener)
return Init()
}
func (gn GfNacosPlugin)Remove()error{
RemoveConfigListener()
if nacosCfg.EnableDiscovery {
UnRegister()
}
fmt.Println("gf-nacos插件被移除。")
return nil
}