blob: 40d404f3780b9a1d6be4502e606685970681e70d (
plain)
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
29
30
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ImpredicativeTypes #-}
module Main (main) where
import Thermoprint.Server
import Thermoprint.Server.Printer.Generic
import Control.Monad.Trans.Resource
import Control.Monad.Logger
import Control.Monad.Reader
import Database.Persist.Sqlite
main :: IO ()
main = thermoprintServer True (Nat runSqlite) $ (\c -> c { queueManagers = queueManagers }) <$> def `withPrinters` printers
where
runSqlite :: ReaderT ConnectionPool (LoggingT IO) a -> IO a
runSqlite = runStderrLoggingT . withSqlitePool "thermoprint.sqlite" 1 . runReaderT
printers = [ (pure $ genericPrint "/dev/usb/lp0", def)
]
queueManagers _ = QMConfig
{ manager = union [ limitHistorySize 100
, limitHistoryAge 3600
]
, collapse = standardCollapse
}
|