Support specifying password via environment variable

This commit is contained in:
Trevor Slocum 2023-12-29 23:02:01 -08:00
parent 0bed4617a8
commit ccf9dd359e

View file

@ -6,6 +6,7 @@ import (
"log"
"net/http"
_ "net/http/pprof"
"os"
"time"
"code.rocket9labs.com/tslocum/bgammon-tabula-bot/bot"
@ -36,6 +37,10 @@ func main() {
flag.IntVar(&debug, "debug", 0, "Port to serve debug information on (pprof)")
flag.Parse()
if password == "" {
password = os.Getenv("BOT_PASSWORD")
}
if debug > 0 {
go func() {
log.Fatal(http.ListenAndServe(fmt.Sprintf("localhost:%d", debug), nil))