Skip to content

Commit

Permalink
update case for v4
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyx committed Sep 9, 2020
1 parent 6f26ceb commit dbd0832
Showing 7 changed files with 12 additions and 14 deletions.
3 changes: 1 addition & 2 deletions custom/cache/check.go
Original file line number Diff line number Diff line change
@@ -15,10 +15,9 @@ func main() {
IsBackupConfig: false,
Secret: "6ce3ff7e96a24335a9634fe9abca6d51",
}
client := agollo.Create()
agollo.SetLogger(&DefaultLogger{})

error:=client.StartWithConfig(func() (*config.AppConfig, error) {
client,error:=agollo.StartWithConfig(func() (*config.AppConfig, error) {
return c, nil
})

5 changes: 2 additions & 3 deletions custom/listener/check.go
Original file line number Diff line number Diff line change
@@ -17,18 +17,17 @@ func main() {
IsBackupConfig: false,
Secret: "6ce3ff7e96a24335a9634fe9abca6d51",
}
client := agollo.Create()
c2 := &CustomChangeListener{}
c2.wg.Add(5)
agollo.AddChangeListener(c2)


error:=client.StartWithConfig(func() (*config.AppConfig, error) {
client,err:=agollo.StartWithConfig(func() (*config.AppConfig, error) {
return c, nil
})


fmt.Println("err:", error)
fmt.Println("err:", err)

c2.wg.Wait()
writeConfig(c.NamespaceName,client)
5 changes: 2 additions & 3 deletions custom/log/check.go
Original file line number Diff line number Diff line change
@@ -18,15 +18,14 @@ func main() {
IsBackupConfig: false,
Secret: "6ce3ff7e96a24335a9634fe9abca6d51",
}
client := agollo.Create()

agollo.SetCache(&DefaultCacheFactory{})

error:=client.StartWithConfig(func() (*config.AppConfig, error) {
client,err:=agollo.StartWithConfig(func() (*config.AppConfig, error) {
return c, nil
})

fmt.Println("err:", error)
fmt.Println("err:", err)

writeConfig(c.NamespaceName,client)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/zouyx/agollo_demo

require github.com/zouyx/agollo/v4 v4.0.0-20200907155315-ec29c24c6dbe
require github.com/zouyx/agollo/v4 v4.0.0-20200909153155-56bb7187be7e

go 1.13
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -190,6 +190,8 @@ github.com/zouyx/agollo/v3 v3.4.5/go.mod h1:LJr3kDmm23QSW+F1Ol4TMHDa7HvJvscMdVxJ
github.com/zouyx/agollo/v4 v4.0.0-20200906104415-bf591b9e6f72/go.mod h1:unhojnZiGLlT4gLpWz3Oa7sGcChZWv/1DJBkV6s8uAE=
github.com/zouyx/agollo/v4 v4.0.0-20200907155315-ec29c24c6dbe h1:FfqcDUo+YHR13zH1hvWinCRVtTNHeDOfM3dEAiEVbxE=
github.com/zouyx/agollo/v4 v4.0.0-20200907155315-ec29c24c6dbe/go.mod h1:unhojnZiGLlT4gLpWz3Oa7sGcChZWv/1DJBkV6s8uAE=
github.com/zouyx/agollo/v4 v4.0.0-20200909153155-56bb7187be7e h1:V2z0tMOy8sNJ5aaT/PhKk4PH+qxbep2nl0ayTuUJRbw=
github.com/zouyx/agollo/v4 v4.0.0-20200909153155-56bb7187be7e/go.mod h1:unhojnZiGLlT4gLpWz3Oa7sGcChZWv/1DJBkV6s8uAE=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
3 changes: 1 addition & 2 deletions helloworld/check.go
Original file line number Diff line number Diff line change
@@ -16,8 +16,7 @@ func main() {
Secret: "6ce3ff7e96a24335a9634fe9abca6d51",
}

client := agollo.Create()
error:=client.StartWithConfig(func() (*config.AppConfig, error) {
_,error:=agollo.StartWithConfig(func() (*config.AppConfig, error) {
return c, nil
})

6 changes: 3 additions & 3 deletions web/check.go
Original file line number Diff line number Diff line change
@@ -23,14 +23,14 @@ var appConfig= &config.AppConfig{
var client *agollo.Client

func main() {
client = agollo.Create()
var err error
agollo.SetLogger(&DefaultLogger{})

error:=client.StartWithConfig(func() (*config.AppConfig, error) {
client,err=agollo.StartWithConfig(func() (*config.AppConfig, error) {
return appConfig, nil
})

fmt.Println("err:", error)
fmt.Println("err:", err)

http.HandleFunc("/check", GetAllConfig)

0 comments on commit dbd0832

Please sign in to comment.