This is an automated email from the ASF dual-hosted git repository. smihaylov pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git
commit a1fd45a7e2c3a7569d3f806425e586623b6f57b7 Author: howardkitto <[email protected]> AuthorDate: Wed Sep 4 16:46:49 2019 +0100 add nodetype to status page --- open-api.yaml | 2 ++ pkg/api/proto.go | 1 + pkg/defaultservice/service.go | 3 ++- pkg/endpoints/endpoints.go | 6 +++--- pkg/service/service.go | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/open-api.yaml b/open-api.yaml index e5ee635..24e7f3f 100644 --- a/open-api.yaml +++ b/open-api.yaml @@ -387,6 +387,8 @@ components: type: string plugin: type: string + nodeType: + type: string tags: - name: identity description: Actors in the system diff --git a/pkg/api/proto.go b/pkg/api/proto.go index 866911d..d0ca577 100644 --- a/pkg/api/proto.go +++ b/pkg/api/proto.go @@ -167,4 +167,5 @@ type StatusResponse struct { ExtensionVendor string `json:"extensionVendor,omitempty"` Extension map[string]string `json:"extension,omitempty"` Plugin string `json:"plugin,omitempty"` + NodeType string `json:"nodeType,omitempty"` } diff --git a/pkg/defaultservice/service.go b/pkg/defaultservice/service.go index e755519..0c4c671 100644 --- a/pkg/defaultservice/service.go +++ b/pkg/defaultservice/service.go @@ -101,11 +101,12 @@ func (s *Service) SetMasterFiduciaryNodeID(masterFiduciaryNodeID string) { } // Status of the server -func (s *Service) Status(apiVersion string) (*api.StatusResponse, error) { +func (s *Service) Status(apiVersion, nodeType string) (*api.StatusResponse, error) { return &api.StatusResponse{ Application: "Milagro Distributed Trust", APIVersion: apiVersion, ExtensionVendor: s.Vendor(), + NodeType: nodeType, NodeCID: s.nodeID, TimeStamp: time.Now(), Plugin: s.Plugin.Name(), diff --git a/pkg/endpoints/endpoints.go b/pkg/endpoints/endpoints.go index ae66d68..40d82d9 100644 --- a/pkg/endpoints/endpoints.go +++ b/pkg/endpoints/endpoints.go @@ -180,7 +180,7 @@ func Endpoints(svc service.Service, corsAllow string, authorizer transport.Autho "Status": { Path: "/" + apiVersion + "/status", Method: http.MethodGet, - Endpoint: MakeStatusEndpoint(svc), + Endpoint: MakeStatusEndpoint(svc, nodeType), NewResponse: func() interface{} { return &api.StatusResponse{} }, Options: transport.ServerOptions( transport.SetCors(corsAllow), @@ -352,9 +352,9 @@ func MakeFulfillOrderSecretEndpoint(m service.Service) endpoint.Endpoint { } //MakeStatusEndpoint - -func MakeStatusEndpoint(m service.Service) endpoint.Endpoint { +func MakeStatusEndpoint(m service.Service, nodeType string) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { - return m.Status(apiVersion) + return m.Status(apiVersion, nodeType) } } diff --git a/pkg/service/service.go b/pkg/service/service.go index 9ec4093..f03534a 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -47,5 +47,5 @@ type Service interface { SetMasterFiduciaryNodeID(masterFiduciaryNodeID string) //System - Status(apiVersion string) (*api.StatusResponse, error) + Status(apiVersion, nopdeType string) (*api.StatusResponse, error) }
