Skip to content

Commit 421f44e

Browse files
graysideknative-prow-robot
authored andcommitted
serving/helloworld-haskell: respect the port env var (#463)
1 parent 3935463 commit 421f44e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

serving/samples/helloworld-haskell/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ following instructions recreate the source files from this folder.
6363
import Web.Scotty.Trans
6464
6565
main :: IO ()
66-
main = do
67-
t <- fromMaybe "World" <$> lookupEnv "TARGET"
68-
scotty 8080 (route t)
66+
main = do
67+
t <- fromMaybe "World" <$> lookupEnv "TARGET"
68+
pStr <- fromMaybe "8080" <$> lookupEnv "PORT"
69+
let p = read pStr :: Int
70+
scotty p (route t)
6971
7072
route :: String -> ScottyM()
7173
route t = get "/" $ hello t

serving/samples/helloworld-haskell/app/Main.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import Web.Scotty.Trans
1111
main :: IO ()
1212
main = do
1313
t <- fromMaybe "World" <$> lookupEnv "TARGET"
14-
scotty 8080 (route t)
14+
pStr <- fromMaybe "8080" <$> lookupEnv "PORT"
15+
let p = read pStr :: Int
16+
scotty p (route t)
1517

1618
route :: String -> ScottyM()
1719
route t = get "/" $ hello t

0 commit comments

Comments
 (0)