Allow override of serving port by env var (#160)

Can now set HISHTORY_SERVER_PORT but will default to 8080.
This commit is contained in:
Richard James
2023-12-23 19:22:26 -06:00
committed by GitHub
parent eec0745fbe
commit 9ac3df1bbb

View File

@ -211,7 +211,11 @@ func main() {
go runBackgroundJobs(context.Background(), srv, db, stats)
if err := srv.Run(context.Background(), ":8080"); err != nil {
port := os.Getenv("HISHTORY_SERVER_PORT")
if port == "" {
port = "8080"
}
if err := srv.Run(context.Background(), ":"+port); err != nil {
panic(err)
}
}