Skip to content

Commit

Permalink
cli vm: add default config if nothing passed
Browse files Browse the repository at this point in the history
Supply VM console with default config.

Close #3450

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
  • Loading branch information
AliceInHunterland committed Jun 6, 2024
1 parent 7a14cb0 commit 2549bd9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cli/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/chzyer/readline"
"github.com/nspcc-dev/neo-go/cli/cmdargs"
"github.com/nspcc-dev/neo-go/cli/config"
"github.com/nspcc-dev/neo-go/cli/options"
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
"github.com/urfave/cli"
Expand All @@ -27,10 +28,13 @@ func startVMPrompt(ctx *cli.Context) error {
if err := cmdargs.EnsureNone(ctx); err != nil {
return err
}

cfg, err := options.GetConfigFromContext(ctx)
if err != nil {
return cli.NewExitError(err, 1)
var err error
cfg := config.VM
if ctx.String("config-file") != "" || ctx.String("config-path") != "" {
cfg, err = options.GetConfigFromContext(ctx)
if err != nil {
return cli.NewExitError(err, 1)

Check warning on line 36 in cli/vm/vm.go

View check run for this annotation

Codecov / codecov/patch

cli/vm/vm.go#L31-L36

Added lines #L31 - L36 were not covered by tests
}
}
if ctx.NumFlags() == 0 {
cfg.ApplicationConfiguration.DBConfiguration.Type = dbconfig.InMemoryDB
Expand Down

0 comments on commit 2549bd9

Please sign in to comment.