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

29 lines
865 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 (pure, (<*>))
import Control.Exception (bracket)
import Data.Word (Word16)
import Locales (version)
import Network (HostName, PortID (..))
import Options
import Server
2012-02-22 22:03:31 +01:00
2014-03-11 18:12:51 +01:00
data MainOptions = MainOptions {
blogPort :: Int,
resourceDir :: String
2014-03-11 18:12:51 +01:00
}
instance Options MainOptions where
defineOptions = pure MainOptions
<*> simpleOption "blogPort" 8000
"Port to serve the blog on. Default is 8000."
2015-11-21 18:55:21 +01:00
<*> simpleOption "resourceDir" "/opt/tazblog/static"
2014-03-11 18:22:59 +01:00
"Resources folder location."
main :: IO()
main = do
putStrLn ("TazBlog " ++ version ++ " in Haskell starting")
runCommand $ \opts _ ->
runBlog (blogPort opts) (resourceDir opts)