mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
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 <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
5566e354d4
commit
ed9817d35b
1 changed files with 9 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/config"
|
"github.com/nspcc-dev/neo-go/config"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||||
|
@ -81,7 +82,6 @@ func LoadFile(configPath string, relativePath ...string) (Config, error) {
|
||||||
var (
|
var (
|
||||||
configData []byte
|
configData []byte
|
||||||
err error
|
err error
|
||||||
config Config
|
|
||||||
)
|
)
|
||||||
if _, err = os.Stat(configPath); os.IsNotExist(err) {
|
if _, err = os.Stat(configPath); os.IsNotExist(err) {
|
||||||
configData, err = getEmbeddedConfig(configPath)
|
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)
|
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 := yaml.NewDecoder(bytes.NewReader(configData))
|
||||||
decoder.KnownFields(true)
|
decoder.KnownFields(true)
|
||||||
err = decoder.Decode(&config)
|
err = decoder.Decode(&config)
|
||||||
|
|
Loading…
Reference in a new issue