mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-17 22:30:37 +08:00
default config
This commit is contained in:
@@ -22,9 +22,16 @@ var Properties *PropertyHolder
|
|||||||
|
|
||||||
func LoadConfig(configFilename string) *PropertyHolder {
|
func LoadConfig(configFilename string) *PropertyHolder {
|
||||||
// open config file
|
// open config file
|
||||||
|
config := &PropertyHolder{
|
||||||
|
Bind: "127.0.0.1",
|
||||||
|
Port: 6379,
|
||||||
|
AppendOnly: true,
|
||||||
|
AppendFilename: "appendonly.aof",
|
||||||
|
}
|
||||||
file, err := os.Open(configFilename)
|
file, err := os.Open(configFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Print(err)
|
||||||
|
return config
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
@@ -48,7 +55,6 @@ func LoadConfig(configFilename string) *PropertyHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parse format
|
// parse format
|
||||||
config := &PropertyHolder{}
|
|
||||||
t := reflect.TypeOf(config)
|
t := reflect.TypeOf(config)
|
||||||
v := reflect.ValueOf(config)
|
v := reflect.ValueOf(config)
|
||||||
n := t.Elem().NumField()
|
n := t.Elem().NumField()
|
||||||
|
Reference in New Issue
Block a user