serving/helloworld-haskell: respect the port env var (#463)

This commit is contained in:
Adam Ross 2018-10-24 11:47:48 -07:00 committed by Knative Prow Robot
parent 3935463648
commit 421f44e47a
2 changed files with 8 additions and 4 deletions

View File

@ -63,9 +63,11 @@ following instructions recreate the source files from this folder.
import Web.Scotty.Trans
main :: IO ()
main = do
t <- fromMaybe "World" <$> lookupEnv "TARGET"
scotty 8080 (route t)
main = do
t <- fromMaybe "World" <$> lookupEnv "TARGET"
pStr <- fromMaybe "8080" <$> lookupEnv "PORT"
let p = read pStr :: Int
scotty p (route t)
route :: String -> ScottyM()
route t = get "/" $ hello t

View File

@ -11,7 +11,9 @@ import Web.Scotty.Trans
main :: IO ()
main = do
t <- fromMaybe "World" <$> lookupEnv "TARGET"
scotty 8080 (route t)
pStr <- fromMaybe "8080" <$> lookupEnv "PORT"
let p = read pStr :: Int
scotty p (route t)
route :: String -> ScottyM()
route t = get "/" $ hello t