diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-29 23:52:04 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-29 23:52:04 +0100 |
commit | 31fef68e9c5a1f9e4a4e7d0f5167c5d8bd4d7b3a (patch) | |
tree | 133415aab9b742c4b73d2ecf658ffdb0e90a63f5 | |
download | thermoprint-config-master.tar thermoprint-config-master.tar.gz thermoprint-config-master.tar.bz2 thermoprint-config-master.tar.xz thermoprint-config-master.zip |
-rw-r--r-- | thermoprint-server.hs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/thermoprint-server.hs b/thermoprint-server.hs new file mode 100644 index 0000000..40d404f --- /dev/null +++ b/thermoprint-server.hs | |||
@@ -0,0 +1,30 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | ||
2 | {-# LANGUAGE ImpredicativeTypes #-} | ||
3 | |||
4 | module Main (main) where | ||
5 | |||
6 | import Thermoprint.Server | ||
7 | |||
8 | import Thermoprint.Server.Printer.Generic | ||
9 | |||
10 | import Control.Monad.Trans.Resource | ||
11 | import Control.Monad.Logger | ||
12 | import Control.Monad.Reader | ||
13 | |||
14 | import Database.Persist.Sqlite | ||
15 | |||
16 | main :: IO () | ||
17 | main = thermoprintServer True (Nat runSqlite) $ (\c -> c { queueManagers = queueManagers }) <$> def `withPrinters` printers | ||
18 | where | ||
19 | runSqlite :: ReaderT ConnectionPool (LoggingT IO) a -> IO a | ||
20 | runSqlite = runStderrLoggingT . withSqlitePool "thermoprint.sqlite" 1 . runReaderT | ||
21 | |||
22 | printers = [ (pure $ genericPrint "/dev/usb/lp0", def) | ||
23 | ] | ||
24 | |||
25 | queueManagers _ = QMConfig | ||
26 | { manager = union [ limitHistorySize 100 | ||
27 | , limitHistoryAge 3600 | ||
28 | ] | ||
29 | , collapse = standardCollapse | ||
30 | } | ||