MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / InitConfig

Function InitConfig

IceFireDB-SQLite/pkg/config/config.go:50–68  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

48var defaultConfig *Config
49
50func InitConfig(path string) {
51 viper.SetConfigFile(path)
52 if err := viper.ReadInConfig(); err != nil {
53 panic(err)
54 }
55
56 err := viper.Unmarshal(defaultConfig)
57 if err != nil {
58 panic(err)
59 }
60
61 if net.ParseIP(defaultConfig.P2P.NodeHostIP) == nil {
62 defaultConfig.P2P.NodeHostIP = "0.0.0.0"
63 }
64
65 if defaultConfig.P2P.NodeHostPort < 0 || defaultConfig.P2P.NodeHostPort > 65535 {
66 defaultConfig.P2P.NodeHostPort = 0
67 }
68}
69
70func Get() *Config {
71 return defaultConfig

Callers 1

mainFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected