chore(storage): support set db path for badger driver (#499)
* chore(storage): support set db path for badger driver Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * fix path Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * fix readme Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * update default value Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -88,6 +88,8 @@ stat:
|
||||
path: "bunt.db"
|
||||
leveldb:
|
||||
path: "level.db"
|
||||
badgerdb:
|
||||
path: "badger.db"
|
||||
`)
|
||||
|
||||
// ConfYaml is config structure.
|
||||
@@ -174,11 +176,12 @@ type SectionLog struct {
|
||||
|
||||
// SectionStat is sub section of config.
|
||||
type SectionStat struct {
|
||||
Engine string `yaml:"engine"`
|
||||
Redis SectionRedis `yaml:"redis"`
|
||||
BoltDB SectionBoltDB `yaml:"boltdb"`
|
||||
BuntDB SectionBuntDB `yaml:"buntdb"`
|
||||
LevelDB SectionLevelDB `yaml:"leveldb"`
|
||||
Engine string `yaml:"engine"`
|
||||
Redis SectionRedis `yaml:"redis"`
|
||||
BoltDB SectionBoltDB `yaml:"boltdb"`
|
||||
BuntDB SectionBuntDB `yaml:"buntdb"`
|
||||
LevelDB SectionLevelDB `yaml:"leveldb"`
|
||||
BadgerDB SectionBadgerDB `yaml:"badgerdb"`
|
||||
}
|
||||
|
||||
// SectionRedis is sub section of config.
|
||||
@@ -204,6 +207,11 @@ type SectionLevelDB struct {
|
||||
Path string `yaml:"path"`
|
||||
}
|
||||
|
||||
// SectionBadgerDB is sub section of config.
|
||||
type SectionBadgerDB struct {
|
||||
Path string `yaml:"path"`
|
||||
}
|
||||
|
||||
// SectionPID is sub section of config.
|
||||
type SectionPID struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
@@ -321,6 +329,7 @@ func LoadConf(confPath string) (ConfYaml, error) {
|
||||
conf.Stat.BoltDB.Bucket = viper.GetString("stat.boltdb.bucket")
|
||||
conf.Stat.BuntDB.Path = viper.GetString("stat.buntdb.path")
|
||||
conf.Stat.LevelDB.Path = viper.GetString("stat.leveldb.path")
|
||||
conf.Stat.BadgerDB.Path = viper.GetString("stat.badgerdb.path")
|
||||
|
||||
// gRPC Server
|
||||
conf.GRPC.Enabled = viper.GetBool("grpc.enabled")
|
||||
|
||||
Reference in New Issue
Block a user