blob: 246f1325e7fcd3605723ec8f3337212b7b7f7fd6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
-- | Main module for the blog's web server
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
data MainOptions = MainOptions {
blogPort :: Int,
resourceDir :: String
}
instance Options MainOptions where
defineOptions = pure MainOptions
<*> simpleOption "blogPort" 8000
"Port to serve the blog on. Default is 8000."
<*> simpleOption "resourceDir" "/opt/tazblog/static"
"Resources folder location."
main :: IO()
main = do
putStrLn ("TazBlog " ++ version ++ " in Haskell starting")
runCommand $ \opts _ ->
runBlog (blogPort opts) (resourceDir opts)
|