Update README to demonstrate how to configure polaris (#2724)

This commit is contained in:
xgd16 2023-06-28 21:33:11 +08:00 committed by GitHub
parent 8aff08581f
commit 92e21c275c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -38,7 +38,7 @@ func main() {
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
// TTL egt 2*time.Second
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
s := g.Server(`hello.svc`)
s.BindHandler("/", func(r *ghttp.Request) {
@ -70,7 +70,7 @@ import (
func main() {
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
for i := 0; i < 100; i++ {
res, err := g.Client().Get(gctx.New(), `http://hello.svc/`)

View File

@ -44,7 +44,7 @@ func main() {
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
// TTL egt 2*time.Second
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
s := g.Server(`hello.svc`)
s.BindHandler("/", func(r *ghttp.Request) {
@ -77,7 +77,7 @@ import (
func main() {
conf := config.NewDefaultConfiguration([]string{"183.47.111.80:8091"})
gsvc.SetRegistry(polaris.NewRegistryWithConfig(conf, polaris.WithTTL(10)))
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(10)))
for i := 0; i < 100; i++ {
res, err := g.Client().Get(gctx.New(), `http://hello.svc/`)
@ -94,4 +94,4 @@ func main() {
## 协议
`GoFrame Polaris` 使用非常友好的 [MIT](../../../LICENSE) 开源协议进行发布,永久`100%`开源免费。
`GoFrame Polaris` 使用非常友好的 [MIT](../../../LICENSE) 开源协议进行发布,永久`100%`开源免费。