From c42f1954126babf6f49f7c9f2c05ae61f7093565 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Wed, 8 Apr 2015 12:54:14 +0200 Subject: [PATCH] Read bind port from the environment --- Main.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Main.hs b/Main.hs index e581356..1cb9a03 100644 --- a/Main.hs +++ b/Main.hs @@ -2,8 +2,14 @@ module Main where import Application + +import Control.Applicative +import System.Environment import Network.Wai.Handler.Warp import Network.Wai.Middleware.RequestLogger + main :: IO () -main = app (run 3000 . logStdout) +main = do + port <- maybe 3000 read <$> lookupEnv "PORT" + app (run port . logStdout) \ No newline at end of file