logging url of service
This commit is contained in:
parent
d1f1cfcd67
commit
5c7addafb9
12
main.go
12
main.go
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -13,7 +14,7 @@ import (
|
|||||||
|
|
||||||
const MAX = 12
|
const MAX = 12
|
||||||
|
|
||||||
var addr = flag.String("addr", ":8000", "address I'll listen on.")
|
var port = flag.Int("port", 8000, "listen on this port")
|
||||||
|
|
||||||
var store = sessions.NewCookieStore([]byte(os.Getenv("MMG_SECRET_KEY")))
|
var store = sessions.NewCookieStore([]byte(os.Getenv("MMG_SECRET_KEY")))
|
||||||
var statics map[string][]byte
|
var statics map[string][]byte
|
||||||
@ -40,7 +41,14 @@ func main() {
|
|||||||
"/reset/",
|
"/reset/",
|
||||||
reset,
|
reset,
|
||||||
)
|
)
|
||||||
if err := http.ListenAndServe(*addr, nil); err != nil {
|
|
||||||
|
hostname, err := os.Hostname()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("problem getting hostname:", err)
|
||||||
|
}
|
||||||
|
log.Printf("serving at: http://%s:%d/", hostname, *port)
|
||||||
|
|
||||||
|
if err := http.ListenAndServe(fmt.Sprintf(":%d", *port), nil); err != nil {
|
||||||
log.Fatal("ListenAndServe:", err)
|
log.Fatal("ListenAndServe:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user