Skip to content

Commit

Permalink
store created app in appCreator
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed May 2, 2024
1 parent b4243d2 commit 1244a51
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/minitiad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
}

func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, basicManager module.BasicManager) {
a := appCreator{encodingConfig}
a := appCreator{nil, encodingConfig}
// you can get app from a.app in post setup handler

rootCmd.AddCommand(
InitCmd(basicManager, minitiaapp.DefaultNodeHome),
Expand Down Expand Up @@ -235,19 +236,25 @@ func txCommand() *cobra.Command {
}

type appCreator struct {
app servertypes.Application
encodingConfig params.EncodingConfig
}

// newApp is an AppCreator
func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application {
func (a *appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application {
baseappOptions := server.DefaultBaseappOptions(appOpts)

return minitiaapp.NewMinitiaApp(
app := minitiaapp.NewMinitiaApp(
logger, db, traceStore, true,
evmconfig.GetConfig(appOpts),
appOpts,
baseappOptions...,
)

// store app in creator
a.app = app

return app
}

func (a appCreator) appExport(
Expand Down

0 comments on commit 1244a51

Please sign in to comment.