Skip to content

Commit

Permalink
add PORT env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tgunsch authored Jan 20, 2021
1 parent 6168e51 commit 4e8e3b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4e8e3b6

Please sign in to comment.