Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(server): alias AppOptions to coreserver.DynamicConfig #21711

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions server/types/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
cmttypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/gogoproto/grpc"

"cosmossdk.io/core/server"
corestore "cosmossdk.io/core/store"
"cosmossdk.io/log"
"cosmossdk.io/store/snapshots"
Expand All @@ -26,9 +27,7 @@ type (
// literal defined on the server Context. Note, casting Get calls may not yield
// the expected types and could result in type assertion errors. It is recommend
// to either use the cast package or perform manual conversion for safety.
AppOptions interface {
Get(string) interface{}
}
AppOptions = server.DynamicConfig

// Application defines an application interface that wraps abci.Application.
// The interface defines the necessary contracts to be implemented in order
Expand Down
4 changes: 4 additions & 0 deletions server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,8 @@ func (m mapGetter) Get(key string) interface{} {
return m[key]
}

func (m mapGetter) GetString(key string) string {
return m[key].(string)
}

var _ servertypes.AppOptions = mapGetter{}
9 changes: 9 additions & 0 deletions testutil/sims/app_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,15 @@ func (m AppOptionsMap) Get(key string) interface{} {
return v
}

func (m AppOptionsMap) GetString(key string) string {
v, ok := m[key]
if !ok {
return ""
}

return v.(string)
}

func NewAppOptionsWithFlagHome(homePath string) servertypes.AppOptions {
return AppOptionsMap{
flags.FlagHome: homePath,
Expand Down
Loading