ing
This commit is contained in:
parent
a3a14c0c3e
commit
9c850df9f7
|
@ -3,6 +3,9 @@ package data
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
logging "git.loafle.net/commons/logging-go"
|
||||
crc "git.loafle.net/commons/rpc-go/client"
|
||||
|
@ -13,8 +16,8 @@ import (
|
|||
)
|
||||
|
||||
func New() (*crc.Client, error) {
|
||||
config := config.GetConfig()
|
||||
if nil == config {
|
||||
_config := config.GetConfig()
|
||||
if nil == _config {
|
||||
return nil, fmt.Errorf("Config is not available")
|
||||
}
|
||||
|
||||
|
@ -23,10 +26,19 @@ func New() (*crc.Client, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if config.Dev {
|
||||
u := url.URL{
|
||||
Scheme: "ws",
|
||||
Host: fmt.Sprintf("%s:%d", strings.Split(_config.Central.Address, ":")[0], 19095),
|
||||
}
|
||||
u.Path = path.Join(u.Path, occp.HTTPEntry_Data)
|
||||
connector.URL = u.String()
|
||||
}
|
||||
|
||||
connector.RequestHeader = func() http.Header {
|
||||
header := make(map[string][]string)
|
||||
header[occp.HTTPRequestHeaderKey_Probe_Method] = []string{occp.HTTPRequestHeaderValue_Probe_Method_Connect}
|
||||
header[occp.HTTPRequestHeaderKey_Probe_ProbeKey] = []string{*config.Probe.Key}
|
||||
header[occp.HTTPRequestHeaderKey_Probe_ProbeKey] = []string{*_config.Probe.Key}
|
||||
return header
|
||||
}
|
||||
connector.ResponseHandler = func(res *http.Response) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
const (
|
||||
ConfigKey = "Config"
|
||||
Dev = true
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
Loading…
Reference in New Issue
Block a user