diff options
Diffstat (limited to 'lib/agent/xdsserver.go')
-rw-r--r-- | lib/agent/xdsserver.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/agent/xdsserver.go b/lib/agent/xdsserver.go index c08bfb1..f74e3ba 100644 --- a/lib/agent/xdsserver.go +++ b/lib/agent/xdsserver.go @@ -39,6 +39,7 @@ import ( type XdsServer struct { *Context ID string + URLIndex string BaseURL string APIURL string PartialURL string @@ -83,6 +84,7 @@ func NewXdsServer(ctx *Context, conf xdsconfig.XDSServerConf) *XdsServer { return &XdsServer{ Context: ctx, ID: _IDTempoPrefix + uuid.NewV1().String(), + URLIndex: conf.URLIndex, BaseURL: conf.URL, APIURL: conf.APIBaseURL + conf.APIPartialURL, PartialURL: conf.APIPartialURL, @@ -155,6 +157,19 @@ func (xs *XdsServer) SetLoggerOutput(out io.Writer) { xs.logOut = out } +// GetConfig +func (xs *XdsServer) GetConfig() xaapiv1.ServerCfg { + return xaapiv1.ServerCfg{ + ID: xs.ID, + URL: xs.BaseURL, + APIURL: xs.APIURL, + PartialURL: xs.PartialURL, + ConnRetry: xs.ConnRetry, + Connected: xs.Connected, + Disabled: xs.Disabled, + } +} + // SendCommand Send a command to XDS Server func (xs *XdsServer) SendCommand(cmd string, body []byte, res interface{}) error { url := cmd @@ -303,6 +318,7 @@ func (xs *XdsServer) PassthroughPost(url string) { xs._Disconnected() } common.APIError(c, err.Error()) + return }) } @@ -353,6 +369,7 @@ func (xs *XdsServer) PassthroughPut(url string) { xs._Disconnected() } common.APIError(c, err.Error()) + return }) } @@ -396,6 +413,7 @@ func (xs *XdsServer) PassthroughDelete(url string) { xs._Disconnected() } common.APIError(c, err.Error()) + return }) } @@ -683,7 +701,7 @@ func (xs *XdsServer) _SocketConnect() error { }) iosk.On("disconnection", func(err error) { - xs.Log.Infof("IO.socket disconnection server %s", xs.ID) + xs.Log.Infof("IO.socket disconnection server %s (APIURL %s)", xs.ID, xs.APIURL) if xs.CBOnDisconnect != nil { xs.CBOnDisconnect(err) } |