diff options
Diffstat (limited to 'bragi/thermoprint-server')
| -rw-r--r-- | bragi/thermoprint-server/thermoprint-server.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bragi/thermoprint-server/thermoprint-server.hs b/bragi/thermoprint-server/thermoprint-server.hs index 4f909f80..6142e7d9 100644 --- a/bragi/thermoprint-server/thermoprint-server.hs +++ b/bragi/thermoprint-server/thermoprint-server.hs | |||
| @@ -13,12 +13,15 @@ import Control.Monad.Reader | |||
| 13 | 13 | ||
| 14 | import Database.Persist.Postgresql | 14 | import Database.Persist.Postgresql |
| 15 | 15 | ||
| 16 | type ServerM = ReaderT ConnectionPool (LoggingT IO) | ||
| 17 | |||
| 16 | main :: IO () | 18 | main :: IO () |
| 17 | main = thermoprintServer True (Nat runDb) $ (\c -> c { queueManagers = queueManagers }) <$> def `withPrinters` printers | 19 | main = thermoprintServer True (Nat runDb) $ (\c -> c { queueManagers = queueManagers }) <$> def `withPrinters` printers |
| 18 | where | 20 | where |
| 19 | runDb :: ReaderT ConnectionPool (LoggingT IO) a -> IO a | 21 | runDb :: ServerM a -> IO a |
| 20 | runDb = runStderrLoggingT . withPostgresqlPool "" 5 . runReaderT | 22 | runDb = runStderrLoggingT . withPostgresqlPool "" 5 . runReaderT |
| 21 | 23 | ||
| 24 | printers :: [(ResourceT ServerM PrinterMethod, QMConfig (ResourceT ServerM))] | ||
| 22 | printers = [ (pure $ genericPrint "/dev/usb/lp0", def) | 25 | printers = [ (pure $ genericPrint "/dev/usb/lp0", def) |
| 23 | ] | 26 | ] |
| 24 | 27 | ||
