mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 16:57:06 +08:00
32 lines
685 B
Go
32 lines
685 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/hdt3213/godis/config"
|
|
"github.com/hdt3213/godis/lib/logger"
|
|
RedisServer "github.com/hdt3213/godis/redis/server"
|
|
"github.com/hdt3213/godis/tcp"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
configFilename := os.Getenv("CONFIG")
|
|
if configFilename == "" {
|
|
configFilename = "redis.conf"
|
|
}
|
|
config.SetupConfig(configFilename)
|
|
logger.Setup(&logger.Settings{
|
|
Path: "logs",
|
|
Name: "godis",
|
|
Ext: ".log",
|
|
TimeFormat: "2006-01-02",
|
|
})
|
|
|
|
err := tcp.ListenAndServeWithSignal(&tcp.Config{
|
|
Address: fmt.Sprintf("%s:%d", config.Properties.Bind, config.Properties.Port),
|
|
}, RedisServer.MakeHandler())
|
|
if err != nil {
|
|
logger.Error(err)
|
|
}
|
|
}
|