Skip to content

Commit

Permalink
update & bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Mar 21, 2020
1 parent 0d7a74e commit e8313f4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.14.1

ARG TOAD_VERSION=0.1.5
ARG TOAD_VERSION=0.1.6

ENV GO111MODULE=on

Expand All @@ -20,4 +20,7 @@ RUN ./toad --get=release

EXPOSE 8080

HEALTHCHECK --interval=5s --timeout=2s --retries=5 --start-period=2s \
CMD ./toad --get health

CMD ["./toad", "--port", "8080"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<p align="center">
<img alt="Toad Logo" src="https://raw.githubusercontent.com/clivern/Toad/master/assets/img/gopher.png?v=0.1.5" width="150" />
<img alt="Toad Logo" src="https://raw.githubusercontent.com/clivern/Toad/master/assets/img/gopher.png?v=0.1.6" width="150" />
<h3 align="center">Toad</h3>
<p align="center">Containerized Application for Testing Purposes</p>
<p align="center">
<a href="https://travis-ci.com/Clivern/Toad"><img src="https://travis-ci.com/Clivern/Toad.svg?branch=master"></a>
<a href="https://github.com/Clivern/Toad/releases"><img src="https://img.shields.io/badge/Version-0.1.5-red.svg"></a>
<a href="https://goreportcard.com/report/github.com/Clivern/Toad"><img src="https://goreportcard.com/badge/github.com/clivern/Toad?v=0.1.5"></a>
<a href="https://github.com/Clivern/Toad/releases"><img src="https://img.shields.io/badge/Version-0.1.6-red.svg"></a>
<a href="https://goreportcard.com/report/github.com/Clivern/Toad"><img src="https://goreportcard.com/badge/github.com/clivern/Toad?v=0.1.6"></a>
<a href="https://hub.docker.com/r/clivern/toad"><img src="https://img.shields.io/badge/Docker-Latest-green"></a>
<a href="https://github.com/Clivern/Toad/blob/master/LICENSE"><img src="https://img.shields.io/badge/LICENSE-MIT-orange.svg"></a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion deployment/k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ spec:
spec:
containers:
- name: toad
image: clivern/toad:release-0.1.5
image: clivern/toad:release-0.1.6
ports:
- containerPort: 8080
22 changes: 22 additions & 0 deletions toad.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func main() {
flag.StringVar(&get, "get", "", "get")
flag.Parse()

if get == "health" {
fmt.Println("i am ok")
return
}

if get == "release" {
fmt.Println(
fmt.Sprintf(
Expand All @@ -59,6 +64,23 @@ func main() {
c.String(http.StatusNoContent, "")
})

r.GET("/_health", func(c *gin.Context) {
u := uuid.Must(uuid.NewV4(), nil)
host, _ := os.Hostname()

log.WithFields(log.Fields{
"time": time.Now().Format("Mon Jan 2 15:04:05 2006"),
"host": host,
"uri": c.Request.URL.Path,
"method": c.Request.Method,
"correlationId": u.String(),
}).Info("Incoming Request")

c.JSON(http.StatusOK, gin.H{
"status": "ok",
})
})

r.GET("/", func(c *gin.Context) {
u := uuid.Must(uuid.NewV4(), nil)
host, _ := os.Hostname()
Expand Down

0 comments on commit e8313f4

Please sign in to comment.