initial commit
This commit is contained in:
commit
a60daddd0c
11 changed files with 333 additions and 0 deletions
25
src/Main.hs
Normal file
25
src/Main.hs
Normal file
|
@ -0,0 +1,25 @@
|
|||
module Main where
|
||||
|
||||
import Control.Concurrent (forkIO, newMVar, newEmptyMVar)
|
||||
import qualified Data.Map as Map
|
||||
import PlausibleQuery (queryPageviewsLoop)
|
||||
import Server (servePages)
|
||||
import TemplateLoader (loadTemplates)
|
||||
import TemplatePage (PageContext (PageContext, ctxPageviews))
|
||||
import System.Environment (getArgs)
|
||||
import qualified Config as C
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
(configFile:_) <- getArgs
|
||||
config <- C.loadConfig configFile
|
||||
let cServe = C.serve config
|
||||
|
||||
templates <- loadTemplates (C.baseUrl cServe) (C.templateDir cServe)
|
||||
putStrLn $ "Found templates: " ++ show (map fst templates)
|
||||
|
||||
context <- newMVar $ PageContext {ctxPageviews = Map.empty}
|
||||
updateNotify <- newEmptyMVar
|
||||
|
||||
_ <- forkIO $ queryPageviewsLoop config context updateNotify
|
||||
servePages (C.port cServe) (Map.fromList templates) context updateNotify
|
Loading…
Add table
Add a link
Reference in a new issue