fix CLI bug
This commit is contained in:
parent
4cbaa630c7
commit
0dcec4ec8e
11
cmd/env.go
11
cmd/env.go
@ -31,10 +31,10 @@ const (
|
||||
|
||||
DB_CACHE_SIZE_MB = "DB_CACHE_SIZE_MB"
|
||||
TRIE_CACHE_SIZE_MB = "TRIE_CACHE_SIZE_MB"
|
||||
|
||||
WRITE_SERVER = "WRITE_SERVER"
|
||||
|
||||
STATEDIFF_WORKERS = "STATEDIFF_WORKERS"
|
||||
LVLDB_PATH = "LVLDB_PATH"
|
||||
LVLDB_ANCIENT = "LVLDB_ANCIENT"
|
||||
STATEDIFF_WORKERS = "STATEDIFF_WORKERS"
|
||||
WRITE_SERVER = "WRITE_SERVER"
|
||||
)
|
||||
|
||||
// Bind env vars for eth node and DB configuration
|
||||
@ -57,7 +57,8 @@ func init() {
|
||||
viper.BindEnv("cache.database", DB_CACHE_SIZE_MB)
|
||||
viper.BindEnv("cache.trie", TRIE_CACHE_SIZE_MB)
|
||||
|
||||
viper.BindEnv("write.serve", WRITE_SERVER)
|
||||
viper.BindEnv("leveldb.path", LVLDB_PATH)
|
||||
viper.BindEnv("leveldb.ancient", LVLDB_ANCIENT)
|
||||
|
||||
viper.BindEnv("statediff.workers", STATEDIFF_WORKERS)
|
||||
}
|
||||
|
@ -50,14 +50,15 @@ type blockRange [2]uint64
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(writeCmd)
|
||||
writeCmd.Flags().String("serve", "", "starts a server which handles write request through endpoints")
|
||||
viper.BindPFlag("write.serve", writeCmd.PersistentFlags().Lookup("serve"))
|
||||
writeCmd.PersistentFlags().String("write-api", "", "starts a server which handles write request through endpoints")
|
||||
viper.BindPFlag("write.serve", writeCmd.PersistentFlags().Lookup("write-api"))
|
||||
}
|
||||
|
||||
func write() {
|
||||
logWithCommand.Info("Starting statediff writer")
|
||||
|
||||
// load params
|
||||
viper.BindEnv("write.serve", WRITE_SERVER)
|
||||
addr := viper.GetString("write.serve")
|
||||
path := viper.GetString("leveldb.path")
|
||||
ancientPath := viper.GetString("leveldb.ancient")
|
||||
if path == "" || ancientPath == "" {
|
||||
@ -119,7 +120,6 @@ func write() {
|
||||
viper.UnmarshalKey("write.params", &diffParams)
|
||||
|
||||
blockRangesCh := make(chan blockRange, 100)
|
||||
addr := viper.GetString("write.serve")
|
||||
go func() {
|
||||
for _, r := range blockRanges {
|
||||
blockRangesCh <- r
|
||||
|
Loading…
Reference in New Issue
Block a user