From 4e8e3b66a378ed02137934a30a8c46482f9d7d5d Mon Sep 17 00:00:00 2001 From: Thomas Gunsch Date: Wed, 20 Jan 2021 11:43:59 +0100 Subject: [PATCH] add PORT env variable --- cmd/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 00e4aec..2d9361a 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -29,6 +29,10 @@ func main() { BASE_PATH_ENV = "BASE_PATH" ) server := echo.New() + port := os.Getenv(PORT) + if port == "" { + port = "8080" + } basePath := os.Getenv(BASE_PATH_ENV) if basePath != "" { basePath = "/" + basePath @@ -59,7 +63,7 @@ func main() { api.POST("/cookies/:cookieName", cookies.PostHandler) api.DELETE("/cookies/:cookieName", cookies.DeleteHandler) - server.Logger.Fatal(server.Start(":8080")) + server.Logger.Fatal(server.Start(":" + port)) } func swaggerMiddleware(path string) echo.MiddlewareFunc {