in cmd/redirector/main.go [17:37]
func main() {
log.SetFlags(log.Lmicroseconds)
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
listenAddr := ":" + port
// TODO(ahmetb): extract server logic to NewServer() to unit test it
mux := http.NewServeMux()
mux.HandleFunc("/", withLogging(redirect))
mux.HandleFunc("/button.svg", staticRedirect("https://storage.googleapis.com/cloudrun/button.svg", http.StatusMovedPermanently))
mux.HandleFunc("/button.png", staticRedirect("https://storage.googleapis.com/cloudrun/button.png", http.StatusMovedPermanently))
err := http.ListenAndServe(listenAddr, mux)
if err == http.ErrServerClosed {
log.Printf("server successfully closed")
} else if err != nil {
log.Fatal(err)
}
}