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

26 lines
556 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 Locales (version)
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
putStrLn ("TazBlog " ++ version ++ " in Haskell starting")
opts <- readOpts
runBlog (blogPort opts) (resourceDir opts)