5 Commits
Author SHA1 Message Date
sm 0964cece0c bump to v0.0.9
I forgot to run make before making the docker image.
2018-02-07 14:47:57 -08:00
sm fdba7a7ecd Adds liveness and readiness 2018-02-07 13:58:15 -08:00
sm 54ced08b5a Added env route 2018-02-07 13:55:26 -08:00
sm 19adf9cb94 fixed bug 2018-01-10 10:18:37 -08:00
sm 79107389cc introduce a bug 2018-01-10 10:16:19 -08:00
+13 -1
View File
@@ -2,11 +2,14 @@ package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
)
const version = "v0.0.9"
type v struct {
Hostname string `json:"hostname"`
V string `json:"version"`
@@ -21,13 +24,22 @@ func main() {
w.Header().Set("Content-Type", "application/json")
r := v{
Hostname: hn,
V: "v0.0.3",
V: version,
}
if err := json.NewEncoder(w).Encode(r); err != nil {
log.Printf("json: %+v", err)
}
})
http.HandleFunc("/env", func(w http.ResponseWriter, req *http.Request) {
for _, line := range os.Environ() {
fmt.Fprintf(w, "%v\n", line)
}
})
http.HandleFunc("/live", health)
http.HandleFunc("/ready", health)
if err := http.ListenAndServe(":8080", nil); err != nil {
log.Fatalf("listen and serve: %v", err)
}
}
func health(w http.ResponseWriter, req *http.Request) {}