Skip to content

Commit

Permalink
配置中心文档优化
Browse files Browse the repository at this point in the history
  • Loading branch information
kesonan committed Aug 28, 2024
1 parent 081f222 commit 8580acd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
20 changes: 8 additions & 12 deletions docs/tasks/configcenter.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_label: 配置中心
slug: /docs/tasks/configcenter
---

go-zero 即将在新版本(v1.7.1)中支持配置中心功能, 本文提前介绍下配置中心的简单使用,使用注意事项和特点介绍。代码 [pr](https://github.com/zeromicro/go-zero/pull/3035).
go-zero 即将在新版本(v1.7.1)中支持配置中心功能, 本文提前介绍下配置中心的简单使用,使用注意事项和特点介绍。代码 https://github.com/zeromicro/go-zero/pull/3035.

## 使用demo

Expand All @@ -24,12 +24,10 @@ type TestSt struct {

func main() {
// 创建 etcd subscriber
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConfig{
EtcdConf: discov.EtcdConf{
Hosts: []string{"localhost:2379"}, // etcd 地址
Key: "test1", // 配置key
},
})
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConf{
Hosts: []string{"localhost:2379"}, // etcd 地址
Key: "test1", // 配置key
})

// 创建 configurator
cc := configurator.MustNewConfigCenter[TestSt](configurator.Config{
Expand Down Expand Up @@ -66,11 +64,9 @@ func main() {
```go
func main() {
// 创建 etcd subscriber
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConfig{
EtcdConf: discov.EtcdConf{
Hosts: []string{"localhost:2379"}, // etcd 地址
Key: "test1", // 配置key
},
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConf{
Hosts: []string{"localhost:2379"}, // etcd 地址
Key: "test1", // 配置key
})

// 创建 configurator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_label: config center
slug: /docs/tasks/configcenter
---

Go-zero will soon support the configuration center function in the new version (v1.7.1). This article introduces the simple use of the configuration center in advance, and introduces the use precautions and characters. code [pr](https://github.com/zeromicro/go-zero/pull/3035).
Go-zero will soon support the configuration center function in the new version (v1.7.1). This article introduces the simple use of the configuration center in advance, and introduces the use precautions and characters. code https://github.com/zeromicro/go-zero/pull/3035.

## Demo

Expand All @@ -24,11 +24,9 @@ type TestSt struct {

func main() {
// 创建 etcd subscriber
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConfig{
EtcdConf: discov.EtcdConf{
Hosts: []string{"localhost:2379"}, // ETCD address
Key: "test1", // Configuration key
},
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConf{
Hosts: []string{"localhost:2379"}, // ETCD address
Key: "test1", // Configuration key
})

// Create configurator
Expand Down Expand Up @@ -66,11 +64,9 @@ func main() {
```go
func main() {
// Create etcd subscriber
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConfig{
EtcdConf: discov.EtcdConf{
Hosts: []string{"localhost:2379"}, // ETCD address
Key: "test1", // Configuration key
},
ss := subscriber.MustNewEtcdSubscriber(subscriber.EtcdConf{
Hosts: []string{"localhost:2379"}, // ETCD address
Key: "test1", // Configuration key
})

// Create configurator
Expand Down

0 comments on commit 8580acd

Please sign in to comment.