tvl-depot/services/tazblog/blog/Main.hs

25 lines
537 B
Haskell
Raw Normal View History

-- | Main module for the blog's web server
2012-02-22 22:03:31 +01:00
module Main where
import Control.Applicative ((<$>), (<*>))
import Server (runBlog)
import System.Environment (getEnv)
2012-02-22 22:03:31 +01:00
data MainOptions
= MainOptions
{ blogPort :: Int,
resourceDir :: String
}
2014-03-11 18:12:51 +01:00
readOpts :: IO MainOptions
readOpts =
MainOptions
<$> (fmap read $ getEnv "PORT")
<*> getEnv "RESOURCE_DIR"
main :: IO ()
main = do
opts <- readOpts
putStrLn ("tazblog starting on port " ++ (show $ blogPort opts))
runBlog (blogPort opts) (resourceDir opts)