Sample app has environment info

This commit is contained in:
Michael Snoyman 2013-07-10 12:59:36 +03:00
parent 235ceca5bb
commit 2baaf48a89
2 changed files with 11 additions and 4 deletions

View File

@ -15,3 +15,4 @@ static-hosts:
redirects: redirects:
- from: mysite.com - from: mysite.com
to: www.mysite.com to: www.mysite.com
postgres: true

View File

@ -15,6 +15,7 @@ main = do
fp <- canonicalizePath "." fp <- canonicalizePath "."
[msg] <- getArgs [msg] <- getArgs
portS <- getEnv "PORT" portS <- getEnv "PORT"
env <- getEnvironment
let port = read portS let port = read portS
logger <- mkRequestLogger def logger <- mkRequestLogger def
{ outputFormat = Apache FromHeader { outputFormat = Apache FromHeader
@ -25,7 +26,12 @@ main = do
liftIO $ hPutStrLn stderr $ "Testing standard error" liftIO $ hPutStrLn stderr $ "Testing standard error"
liftIO $ hFlush stderr liftIO $ hFlush stderr
return $ responseLBS status200 [("content-type", "text/plain")] $ L8.pack $ unlines return $ responseLBS status200 [("content-type", "text/plain")] $ L8.pack $ unlines
[ "Message: " ++ msg $ ("Message: " ++ msg)
, "Path: " ++ fp : ("Path: " ++ fp)
, "Headers: " ++ show (requestHeaders req) : ("Headers: " ++ show (requestHeaders req))
] : map (\(k, v) -> concat
[ "Env: "
, k
, " = "
, v
]) env