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:
- from: mysite.com
to: www.mysite.com
postgres: true

View File

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