fix(server/v2/store): fix store server flags (#21745)
This commit is contained in:
parent
c0eced8d7e
commit
e49ecfe4ed
@ -91,7 +91,7 @@ func createRootStore(cmd *cobra.Command, v *viper.Viper, logger log.Logger) (sto
|
||||
}
|
||||
dbType = db.DBType(dbStr)
|
||||
} else {
|
||||
dbType = db.DBType(v.GetString("store.app-db-backend"))
|
||||
dbType = db.DBType(v.GetString(FlagAppDBBackend))
|
||||
}
|
||||
scRawDb, err := db.NewDB(dbType, "application", filepath.Join(rootDir, "data"), nil)
|
||||
if err != nil {
|
||||
|
||||
@ -1,7 +1,16 @@
|
||||
package store
|
||||
|
||||
const (
|
||||
FlagAppDBBackend = "app-db-backend"
|
||||
FlagKeepRecent = "keep-recent"
|
||||
FlagInterval = "interval"
|
||||
import "fmt"
|
||||
|
||||
// start flags are prefixed with the server name
|
||||
// as the config in prefixed with the server name
|
||||
// this allows viper to properly bind the flags
|
||||
func prefix(f string) string {
|
||||
return fmt.Sprintf("%s.%s", ServerName, f)
|
||||
}
|
||||
|
||||
var (
|
||||
FlagAppDBBackend = prefix("app-db-backend")
|
||||
FlagKeepRecent = prefix("keep-recent")
|
||||
FlagInterval = prefix("interval")
|
||||
)
|
||||
|
||||
@ -11,6 +11,14 @@ import (
|
||||
serverv2 "cosmossdk.io/server/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
_ serverv2.ServerComponent[transaction.Tx] = (*StoreComponent[transaction.Tx])(nil)
|
||||
_ serverv2.HasConfig = (*StoreComponent[transaction.Tx])(nil)
|
||||
_ serverv2.HasCLICommands = (*StoreComponent[transaction.Tx])(nil)
|
||||
)
|
||||
|
||||
const ServerName = "store"
|
||||
|
||||
// StoreComponent manages store config
|
||||
// and contains prune & snapshot commands
|
||||
type StoreComponent[T transaction.Tx] struct {
|
||||
@ -35,7 +43,7 @@ func (s *StoreComponent[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logg
|
||||
}
|
||||
|
||||
func (s *StoreComponent[T]) Name() string {
|
||||
return "store"
|
||||
return ServerName
|
||||
}
|
||||
|
||||
func (s *StoreComponent[T]) Start(ctx context.Context) error {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user