fix example tracing edge config (#76)
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
{
|
{
|
||||||
"Server": "localhost:3456"
|
"Name": "edge-api",
|
||||||
|
"Host": "0.0.0.0",
|
||||||
|
"Port": 3456,
|
||||||
|
"Portal": {
|
||||||
|
"Etcd": {
|
||||||
|
"Hosts": [
|
||||||
|
"localhost:2379"
|
||||||
|
],
|
||||||
|
"Key": "portal"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ var (
|
|||||||
client rpcx.Client
|
client rpcx.Client
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
rest.RestConf
|
||||||
|
Portal rpcx.RpcClientConf
|
||||||
|
}
|
||||||
|
|
||||||
func handle(w http.ResponseWriter, r *http.Request) {
|
func handle(w http.ResponseWriter, r *http.Request) {
|
||||||
conn := client.Conn()
|
conn := client.Conn()
|
||||||
greet := portal.NewPortalClient(conn)
|
greet := portal.NewPortalClient(conn)
|
||||||
@@ -34,16 +39,16 @@ func handle(w http.ResponseWriter, r *http.Request) {
|
|||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
var c rpcx.RpcClientConf
|
var c Config
|
||||||
conf.MustLoad(*configFile, &c)
|
conf.MustLoad(*configFile, &c)
|
||||||
client = rpcx.MustNewClient(c)
|
client = rpcx.MustNewClient(c.Portal)
|
||||||
engine := rest.MustNewServer(rest.RestConf{
|
engine := rest.MustNewServer(rest.RestConf{
|
||||||
ServiceConf: service.ServiceConf{
|
ServiceConf: service.ServiceConf{
|
||||||
Log: logx.LogConf{
|
Log: logx.LogConf{
|
||||||
Mode: "console",
|
Mode: "console",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Port: 3333,
|
Port: c.Port,
|
||||||
})
|
})
|
||||||
defer engine.Stop()
|
defer engine.Stop()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user