Allow specifying data source via environment variable

This commit is contained in:
Trevor Slocum 2023-11-21 16:23:35 -08:00
parent b4bbf10287
commit 8cba945823

View file

@ -6,6 +6,7 @@ import (
"log"
"net/http"
_ "net/http/pprof"
"os"
)
func main() {
@ -25,6 +26,10 @@ func main() {
flag.BoolVar(&rollStatistics, "statistics", false, "print dice roll statistics and exit")
flag.Parse()
if dataSource == "" {
dataSource = os.Getenv("BGAMMON_DB")
}
if rollStatistics {
printRollStatistics()
return