Created
March 23, 2018 16:19
-
-
Save mhoran/4104409fb09585147472228de7295fc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"os" | |
"time" | |
) | |
func main() { | |
for i := 0; i < 15; i++ { | |
port := os.Getenv("PORT") | |
res, err := http.Get(fmt.Sprintf("http://localhost:%s", port)) | |
if err == nil && res.StatusCode != 500 { | |
fmt.Println("app up") | |
os.Exit(0) | |
} | |
time.Sleep(1 * time.Second) | |
} | |
fmt.Println("app never came up") | |
os.Exit(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment