Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

Commit

Permalink
base_path support config #9
Browse files Browse the repository at this point in the history
  • Loading branch information
silenceper committed Feb 22, 2017
1 parent 1a97362 commit 982feb3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ Distributed Configuration Management Platform
> go get github.com/silenceper/dcmp
> ./service.sh

```

### 配置

```
listen: "0.0.0.0:8000" # 监听的IP,端口
base_path: "/config" #etcd读取的根目录
endpoints: # etcd 接入地址
- "http://127.0.0.1:2379"
# etcd ssl 配置
#
# ca_file: "/path/to/ca.crt"
# cert_file: "/path/to/client.crt"
# key_file: "/path/to/client.key"
```

### 界面预览
Expand Down
2 changes: 1 addition & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func doIndex(c *gin.Context) {
}

func doKeyList(c *gin.Context) {
resp, err := etcd.GetKeyList("/config")
resp, err := etcd.GetKeyList(cfg.BasePath)
if err != nil {
util.RenderError(c, -1, err.Error())
return
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type config struct {
Listen string `yaml:"listen"`
Endpoints []string `yaml:"endpoints"`
BasePath string `yaml:"base_path"`
CaFile string `yaml:"ca_file"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
Expand Down
2 changes: 2 additions & 0 deletions config/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
listen: "0.0.0.0:8000"

base_path: "/config"

# etcd ssl support config
#
# ca_file: "/path/to/ca.crt"
Expand Down

0 comments on commit 982feb3

Please sign in to comment.