Skip to content

Commit

Permalink
seal the config
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Sep 11, 2024
1 parent b918e44 commit 97183d5
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cmd/minitiad/root.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package main

import (
"context"
"errors"
"io"
"os"
"path"
"path/filepath"

tmcli "github.com/cometbft/cometbft/libs/cli"
"golang.org/x/sync/errgroup"

"github.com/prometheus/client_golang/prometheus"

Expand Down Expand Up @@ -100,6 +98,11 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
Use: basename,
Short: "minitia App",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// except for launch command, seal the config
if cmd.Name() != "launch" {
sdk.GetConfig().Seal()
}

// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())
Expand Down Expand Up @@ -161,13 +164,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, b
snapshot.Cmd(a.AppCreator()),
)

server.AddCommandsWithStartCmdOptions(rootCmd, minitiaapp.DefaultNodeHome, a.AppCreator(), a.appExport, server.StartCmdOptions{
AddFlags: addModuleInitFlags,
PostSetup: func(svrCtx *server.Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error {
sdk.GetConfig().Seal()
return nil
},
})
server.AddCommands(rootCmd, minitiaapp.DefaultNodeHome, a.AppCreator(), a.appExport, addModuleInitFlags)
wasmcli.ExtendUnsafeResetAllCmd(rootCmd)

// add keybase, auxiliary RPC, query, and tx child commands
Expand Down

0 comments on commit 97183d5

Please sign in to comment.