Skip to content

Commit 0972f16

Browse files
authored
refactor: migrate to viper configure manage (#1946)
1 parent e1130f4 commit 0972f16

File tree

4 files changed

+422
-111
lines changed

4 files changed

+422
-111
lines changed

api/cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
)
3131

3232
var (
33-
configFile string
3433
forceStart bool
3534
)
3635

@@ -52,7 +51,7 @@ func init() {
5251
}
5352
})
5453

55-
rootCmd.PersistentFlags().StringVarP(&configFile, "config", "c", "./conf/conf.yml", "config file")
54+
rootCmd.PersistentFlags().StringVarP(&conf.ConfigFile, "config", "c", "", "config file")
5655
rootCmd.PersistentFlags().StringVarP(&conf.WorkDir, "work-dir", "p", ".", "current work directory")
5756
rootCmd.PersistentFlags().BoolVarP(&forceStart, "force", "f", false, "force start manager-api")
5857

api/go.mod

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ replace github.com/coreos/bbolt => go.etcd.io/bbolt v1.3.5
99
require (
1010
github.com/coreos/bbolt v1.3.2 // indirect
1111
github.com/coreos/etcd v3.3.25+incompatible // indirect
12-
github.com/coreos/go-semver v0.3.0 // indirect
1312
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
1413
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
1514
github.com/dgrijalva/jwt-go v3.2.0+incompatible
@@ -19,32 +18,27 @@ require (
1918
github.com/gin-contrib/pprof v1.3.0
2019
github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e
2120
github.com/gin-gonic/gin v1.6.3
22-
github.com/gogo/protobuf v1.3.2 // indirect
23-
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
2421
github.com/google/uuid v1.1.2 // indirect
2522
github.com/gorilla/websocket v1.4.2 // indirect
2623
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect
27-
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
2824
github.com/jonboulle/clockwork v0.2.2 // indirect
29-
github.com/json-iterator/go v1.1.11 // indirect
3025
github.com/prometheus/client_golang v1.8.0 // indirect
3126
github.com/satori/go.uuid v1.2.0
3227
github.com/shiningrush/droplet v0.2.6-0.20210127040147-53817015cd1b
3328
github.com/shiningrush/droplet/wrapper/gin v0.2.1
3429
github.com/sirupsen/logrus v1.7.0 // indirect
3530
github.com/sony/sonyflake v1.0.0
3631
github.com/spf13/cobra v0.0.3
37-
github.com/spf13/pflag v1.0.5 // indirect
32+
github.com/spf13/viper v1.8.1
3833
github.com/stretchr/testify v1.7.0
3934
github.com/takama/daemon v1.0.0
4035
github.com/tidwall/gjson v1.6.7
4136
github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966 // indirect
4237
github.com/xeipuuv/gojsonschema v1.2.0
4338
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da
4439
go.etcd.io/etcd v3.3.25+incompatible
45-
go.uber.org/zap v1.16.0
40+
go.uber.org/zap v1.17.0
4641
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
47-
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
4842
gopkg.in/yaml.v2 v2.4.0
4943
sigs.k8s.io/yaml v1.2.0 // indirect
5044
)

0 commit comments

Comments
 (0)