From 950f35de34afc3ddca7d3837e288a27506d26026 Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Thu, 6 Jun 2024 13:49:00 +0300 Subject: [PATCH] cli vm: add default config if nothing passed Supply VM console with default config. Close #3450 Signed-off-by: Ekaterina Pavlova --- cli/vm/vm.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cli/vm/vm.go b/cli/vm/vm.go index e9e1e2a58..2ab01c2b3 100644 --- a/cli/vm/vm.go +++ b/cli/vm/vm.go @@ -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" @@ -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) + } } if ctx.NumFlags() == 0 { cfg.ApplicationConfiguration.DBConfiguration.Type = dbconfig.InMemoryDB