Browse Source

连接服务器增加参数设置

master v0.1.1
guzeng 3 years ago
parent
commit
9535059463
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      conn.go

+ 5
- 1
conn.go View File

@ -6,9 +6,13 @@ import (
func rpc_server_conn(url ...string) (*ProductServiceClient, error) { func rpc_server_conn(url ...string) (*ProductServiceClient, error) {
var rpc_url string = "127.0.0.1:" + conf.PRODUCT_RPC_PORT
var rpc_url string
if len(url) > 0 && url[0] != "" { if len(url) > 0 && url[0] != "" {
rpc_url = url[0] rpc_url = url[0]
} else if conf.PRODUCT_RPC_URL != "" {
rpc_url = conf.PRODUCT_RPC_URL
} else {
rpc_url = "127.0.0.1:" + conf.PRODUCT_RPC_PORT
} }
conn, _, err := DialProductService("tcp", rpc_url) conn, _, err := DialProductService("tcp", rpc_url)
if err != nil { if err != nil {


Loading…
Cancel
Save