diff options
author | Tyler Davis <tydavis@gmail.com> | 2017-11-29 17:40:52 -0800 |
---|---|---|
committer | Tyler Davis <tydavis@gmail.com> | 2017-11-29 17:40:52 -0800 |
commit | 8e14e0c98623d04f4f703e6e10b4a86c54d15f74 (patch) | |
tree | d0ff5ceb5e6dca6019ca883e8e2bd0135c6b3998 | |
parent | 503d4924964b2b28a34106f7b9b5385ace532ee3 (diff) | |
download | show-readiness-8e14e0c98623d04f4f703e6e10b4a86c54d15f74.tar.gz show-readiness-8e14e0c98623d04f4f703e6e10b4a86c54d15f74.zip |
Remove dependencies
-rw-r--r-- | main.go | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -6,11 +6,12 @@ import ( "net/http" "os" "time" - - "github.com/facebookgo/httpdown" ) +// ReadyValue indiciates the program is ready to receive traffic var ReadyValue = http.StatusOK + +// LiveValue indiciates the program is alive and should not be terminated var LiveValue = http.StatusOK var hostname string @@ -53,8 +54,8 @@ func main() { // Force log output to stdout for Docker log.SetOutput(os.Stdout) - // Delay for startup - var delay time.Duration = (1 * time.Second) + // Configurable delay for startup + var delay = (1 * time.Second) if os.Getenv("APPDELAY") != "" { var err error delay, err = time.ParseDuration(os.Getenv("APPDELAY")) @@ -77,16 +78,13 @@ func main() { mux.HandleFunc("/killMe", killMe) server := &http.Server{ - Addr: ":80", - Handler: mux, - } - - hd := &httpdown.HTTP{ - StopTimeout: 10 * time.Second, - KillTimeout: 1 * time.Second, + Addr: ":80", + Handler: mux, + ReadTimeout: 3 * time.Second, + WriteTimeout: 3 * time.Second, } - if err := httpdown.ListenAndServe(server, hd); err != nil { + if err := server.ListenAndServe(); err != nil { log.Fatalln(err) } |