[5.0-beta] Split into library and executable
This commit is contained in:
parent
71b2ccd927
commit
0f6ff6310e
3 changed files with 19 additions and 11 deletions
|
|
@ -14,7 +14,7 @@ import BlogDB (BlogLang (..))
|
|||
|
||||
data BlogError = NotFound | DBError
|
||||
|
||||
version = "4.2"
|
||||
version = "5.0-beta"
|
||||
|
||||
allLang = [EN, DE]
|
||||
|
||||
|
|
|
|||
38
src/Main.hs
38
src/Main.hs
|
|
@ -1,38 +0,0 @@
|
|||
module Main where
|
||||
|
||||
import Control.Applicative (pure, (<$>), (<*>))
|
||||
import Control.Exception (bracket)
|
||||
import Data.Acid
|
||||
import Data.Acid.Local (createCheckpointAndClose)
|
||||
import Options
|
||||
|
||||
import BlogDB (initialBlogState)
|
||||
import Locales (version)
|
||||
import Server
|
||||
|
||||
{- Server -}
|
||||
|
||||
data MainOptions = MainOptions {
|
||||
optState :: String,
|
||||
optPort :: Int,
|
||||
optRes :: String
|
||||
}
|
||||
|
||||
instance Options MainOptions where
|
||||
defineOptions = pure MainOptions
|
||||
<*> simpleOption "statedir" "/var/tazblog/"
|
||||
"Directory in which the BlogState is located."
|
||||
<*> simpleOption "port" 8000
|
||||
"Port to run on. Default is 8000."
|
||||
<*> simpleOption "res" "/usr/share/tazblog/res"
|
||||
"Resources folder location."
|
||||
|
||||
main :: IO()
|
||||
main = do
|
||||
putStrLn ("TazBlog " ++ version ++ " in Haskell starting")
|
||||
runCommand $ \opts args ->
|
||||
bracket (openLocalStateFrom (optState opts ++ "BlogState") initialBlogState)
|
||||
createCheckpointAndClose
|
||||
(\acid -> runBlog acid (optPort opts) (optRes opts))
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue