test/db.go
ston1th 10ad216fcf
All checks were successful
the build was successful
fixed helm chart
2019-01-18 21:54:13 +01:00

33 lines
685 B
Go

package main
import (
"fmt"
"log"
"net/http"
"os"
"time"
)
var version string
func main() {
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Printf("%s %s %s", r.RemoteAddr, r.Method, r.URL)
h, err := os.Hostname()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
fmt.Fprintf(w, "%s (%s)\n", h, version)
})
s := &http.Server{
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
Addr: ":8080",
}
log.Fatal(s.ListenAndServe())
}