diff --git a/config.yaml.example b/config.yaml.example index 5ef4415..55ee942 100644 --- a/config.yaml.example +++ b/config.yaml.example @@ -13,6 +13,7 @@ app: upload_image_allow_exts: ['.jpg','.jpeg','.png'] server: http_port: 8000 + rpc_port: 8001 read_timeout: 60 write_timeout: 60 tracer_host_port: '127.0.0.1:6831' diff --git a/config/server.go b/config/server.go index 51589cc..1260df6 100644 --- a/config/server.go +++ b/config/server.go @@ -1,13 +1,14 @@ /* * @Date: 2021-03-22 09:54:07 * @LastEditors: viletyy - * @LastEditTime: 2021-06-14 20:40:49 + * @LastEditTime: 2021-06-19 22:38:44 * @FilePath: /potato/config/server.go */ package config type Server struct { HttpPort int64 `mapstructure:"http_port" json:"http_port" yaml:"http_port"` + RpcPort int64 `mapstructure:"rpc_port" json:"rpc_port" yaml:"rpc_port"` ReadTimeout int64 `mapstructure:"read_timeout" json:"read_timeout" yaml:"read_timeout"` WriteTimeout int64 `mapstructure:"write_timeout" json:"write_timeout" yaml:"write_timeout"` TracerHostPort string `mapstructure:"tracer_host_port" json:"tracer_host_port" yaml:"tracer_host_port"` diff --git a/initialize/grpc.go b/initialize/grpc.go index 930d27f..cb8f314 100644 --- a/initialize/grpc.go +++ b/initialize/grpc.go @@ -1,7 +1,7 @@ /* * @Date: 2021-06-17 00:19:32 * @LastEditors: viletyy - * @LastEditTime: 2021-06-17 00:33:38 + * @LastEditTime: 2021-06-19 22:41:24 * @FilePath: /potato/initialize/grpc.go */ package initialize @@ -12,6 +12,7 @@ import ( "github.com/viletyy/potato/global" pb "github.com/viletyy/potato/proto/basic" "github.com/viletyy/potato/server/basic" + "github.com/viletyy/yolk/convert" "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) @@ -22,7 +23,7 @@ func RunGrpc() { reflection.Register(server) go func() { - listen, err := net.Listen("tcp", ":10002") + listen, err := net.Listen("tcp", ":"+convert.ToString(global.GO_CONFIG.Server.RpcPort)) if err != nil { global.GO_LOG.Sugar().Fatalf("net.Listen err: %v", err) }