From ed9817d35b2920a2d920b25ef568537b0dbc8128 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 5 Jul 2024 13:31:25 +0300 Subject: [PATCH] config: get back default node configuration values This code was accidentally removed by https://github.com/nspcc-dev/neo-go/pull/3477, it's important to have these fields set by default. Signed-off-by: Anna Shaleva --- pkg/config/config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 27b46a2a5..2ab072cc5 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "path/filepath" + "time" "github.com/nspcc-dev/neo-go/config" "github.com/nspcc-dev/neo-go/pkg/config/netmode" @@ -81,7 +82,6 @@ func LoadFile(configPath string, relativePath ...string) (Config, error) { var ( configData []byte err error - config Config ) if _, err = os.Stat(configPath); os.IsNotExist(err) { configData, err = getEmbeddedConfig(configPath) @@ -94,6 +94,14 @@ func LoadFile(configPath string, relativePath ...string) (Config, error) { return Config{}, fmt.Errorf("unable to read config: %w", err) } } + config := Config{ + ApplicationConfiguration: ApplicationConfiguration{ + P2P: P2P{ + PingInterval: 30 * time.Second, + PingTimeout: 90 * time.Second, + }, + }, + } decoder := yaml.NewDecoder(bytes.NewReader(configData)) decoder.KnownFields(true) err = decoder.Decode(&config)