From 6b7051ea9537ff06a4f1873bf3874442ebaa5040 Mon Sep 17 00:00:00 2001 From: guzeng Date: Tue, 17 Aug 2021 11:19:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=9C=8D=E5=8A=A1=E6=97=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.siteinfo_test.go | 2 +- common.go | 15 ++++++++++++--- go.mod | 1 + go.sum | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/client.siteinfo_test.go b/client.siteinfo_test.go index 9bc7d26..0c850c8 100644 --- a/client.siteinfo_test.go +++ b/client.siteinfo_test.go @@ -6,7 +6,7 @@ import ( func Test_GetSiteInfoByHost(t *testing.T) { - res, err := GetSiteInfoByHost("http://devmaster.tetele.net", "dev.tetele.net") + res, err := GetSiteInfoByHost("dev.tetele.net") t.Log(res) t.Log(err) diff --git a/common.go b/common.go index 4172bdf..8f2d32b 100644 --- a/common.go +++ b/common.go @@ -1,14 +1,23 @@ package siterpc +import ( + "git.tetele.net/tgo/conf" +) + var DES_KEY = "confdata" func rpc_server_conn(url ...string) (*SiteServiceClient, error) { - var wx_rpc_url string = "127.0.0.1:7971" + var rpc_url string if len(url) > 0 && url[0] != "" { - wx_rpc_url = url[0] + rpc_url = url[0] + } else if conf.SITE_RPC_URL != "" { + rpc_url = conf.SITE_RPC_URL + } else { + rpc_url = "127.0.0.1:" + conf.SITE_RPC_PORT } - conn, _, err := DialSiteService("tcp", wx_rpc_url) + + conn, _, err := DialSiteService("tcp", rpc_url) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 227a396..c8b1ec9 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module git.tetele.net/tgo/siterpc go 1.14 require ( + git.tetele.net/tgo/conf v0.33.1 // indirect git.tetele.net/tgo/crypter v0.2.2 // indirect github.com/chai2010/protorpc v1.0.0 // indirect github.com/golang/protobuf v1.5.2 // indirect diff --git a/go.sum b/go.sum index c06e36b..a83b137 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +git.tetele.net/tgo/conf v0.33.1 h1:ZEIv3Vq35RCv5f3T3Uz97s2mkZLl7W5OlmXvzI3/sS8= +git.tetele.net/tgo/conf v0.33.1/go.mod h1:AWVIBEDE5dtotthUgR0SWaR2Qa6/f+O5WQ3s7Tj8q7A= git.tetele.net/tgo/crypter v0.2.2 h1:YMQJh2Gj5Po4ZfelJUmXBKi01UbmtiSy3bmqRfnYQMo= git.tetele.net/tgo/crypter v0.2.2/go.mod h1:vfvRLZA8+lHNgNXneOcgvVhDyuv25ZRb+C6xHOmXNx0= github.com/chai2010/protorpc v1.0.0 h1:aJ45G9sl1utSKo35EqnBSTs5jqTpdJDJAuZMMYPAtFo=