From f79fb1747f45a68fa8fc878a9193abac721a4f8d Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Sun, 25 Oct 2020 23:44:40 +0100 Subject: [PATCH] Respect PORT environment variable this makes it easier to run on PaaS as heroku --- lnme.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lnme.go b/lnme.go index 43d6737..0fd4439 100644 --- a/lnme.go +++ b/lnme.go @@ -141,7 +141,11 @@ func main() { return c.JSON(http.StatusOK, "pong") }) - e.Logger.Fatal(e.Start(":" + cfg.String("port"))) + port := cfg.String("port") + if os.Getenv("PORT") != "" { + port = os.Getenv("PORT") + } + e.Logger.Fatal(e.Start(":" + port)) } func LoadConfig() *koanf.Koanf {