feat(storage): update conf

This commit is contained in:
bandl 2021-10-15 22:35:16 +08:00
parent 554f7feef9
commit 57a655a708
1 changed files with 4 additions and 3 deletions

View File

@ -3,14 +3,16 @@ package cmd
import (
"fmt"
"gitee.com/timedb/wheatCache/storage/server/single"
"log"
"net"
"os"
"os/signal"
"syscall"
"gitee.com/timedb/wheatCache/storage/server/single"
_ "gitee.com/timedb/wheatCache/conf"
"gitee.com/timedb/wheatCache/pkg/logx"
"gitee.com/timedb/wheatCache/pkg/proto"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@ -25,7 +27,6 @@ var rootCmd = &cobra.Command{
Long: `start storage server`,
Run: func(cmd *cobra.Command, args []string) {
storageServer := single.NewServer()
// 先写死, 等配置文件
conf := viper.GetStringMap("storage")
host := conf["host"].(string)
port := conf["port"].(int)
@ -37,7 +38,7 @@ var rootCmd = &cobra.Command{
listen, err := net.ListenTCP("tcp", tcpAddr)
if err != nil {
log.Panicln(err)
logx.Panicln(err)
}
s := grpc.NewServer()
proto.RegisterCommServerServer(s, storageServer)