Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
f539b9bd
Unverified
Commit
f539b9bd
authored
Sep 09, 2020
by
Janoš Guljaš
Committed by
GitHub
Sep 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add git commit to version and expose version in debugapi (#684)
parent
ff8e5fab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
Makefile
Makefile
+2
-4
status.go
pkg/debugapi/status.go
+5
-2
status_test.go
pkg/debugapi/status_test.go
+5
-2
No files found.
Makefile
View file @
f539b9bd
...
...
@@ -4,10 +4,8 @@ GOLANGCI_LINT_VERSION ?= v1.30.0
GOGOPROTOBUF
?=
protoc-gen-gogofaster
GOGOPROTOBUF_VERSION
?=
v1.3.1
LDFLAGS
?=
-s
-w
ifdef
COMMIT
LDFLAGS
+=
-X
github.com/ethersphere/bee.commit
=
"
$(COMMIT)
"
endif
COMMIT
?=
"
$(
shell
git describe --long --dirty --always --match "" || true
)
"
LDFLAGS
?=
-s
-w
-X
github.com/ethersphere/bee.commit
=
"
$(COMMIT)
"
.PHONY
:
all
all
:
build lint vet test-race binary
...
...
pkg/debugapi/status.go
View file @
f539b9bd
...
...
@@ -7,15 +7,18 @@ package debugapi
import
(
"net/http"
"github.com/ethersphere/bee"
"github.com/ethersphere/bee/pkg/jsonhttp"
)
type
statusResponse
struct
{
Status
string
`json:"status"`
Status
string
`json:"status"`
Version
string
`json:"version"`
}
func
(
s
*
server
)
statusHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
jsonhttp
.
OK
(
w
,
statusResponse
{
Status
:
"ok"
,
Status
:
"ok"
,
Version
:
bee
.
Version
,
})
}
pkg/debugapi/status_test.go
View file @
f539b9bd
...
...
@@ -8,6 +8,7 @@ import (
"net/http"
"testing"
"github.com/ethersphere/bee"
"github.com/ethersphere/bee/pkg/debugapi"
"github.com/ethersphere/bee/pkg/jsonhttp/jsonhttptest"
)
...
...
@@ -17,7 +18,8 @@ func TestHealth(t *testing.T) {
jsonhttptest
.
Request
(
t
,
testServer
.
Client
,
http
.
MethodGet
,
"/health"
,
http
.
StatusOK
,
jsonhttptest
.
WithExpectedJSONResponse
(
debugapi
.
StatusResponse
{
Status
:
"ok"
,
Status
:
"ok"
,
Version
:
bee
.
Version
,
}),
)
}
...
...
@@ -27,7 +29,8 @@ func TestReadiness(t *testing.T) {
jsonhttptest
.
Request
(
t
,
testServer
.
Client
,
http
.
MethodGet
,
"/readiness"
,
http
.
StatusOK
,
jsonhttptest
.
WithExpectedJSONResponse
(
debugapi
.
StatusResponse
{
Status
:
"ok"
,
Status
:
"ok"
,
Version
:
bee
.
Version
,
}),
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment