diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-03-09 22:02:46 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-03-09 22:02:46 +0100 |
commit | cf6ba7cbff444db49797076b70a639961f29e8ef (patch) | |
tree | eb65ccc902fb0e443bf194870d628c99d430e7d3 /bragi/thermoprint-server | |
parent | 03025c105e5fb3055e57e2df9d2af258d579ff7f (diff) | |
download | nixos-cf6ba7cbff444db49797076b70a639961f29e8ef.tar nixos-cf6ba7cbff444db49797076b70a639961f29e8ef.tar.gz nixos-cf6ba7cbff444db49797076b70a639961f29e8ef.tar.bz2 nixos-cf6ba7cbff444db49797076b70a639961f29e8ef.tar.xz nixos-cf6ba7cbff444db49797076b70a639961f29e8ef.zip |
Syntax
Diffstat (limited to 'bragi/thermoprint-server')
-rw-r--r-- | bragi/thermoprint-server/thermoprint-server.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bragi/thermoprint-server/thermoprint-server.hs b/bragi/thermoprint-server/thermoprint-server.hs index 97b37374..7e571021 100644 --- a/bragi/thermoprint-server/thermoprint-server.hs +++ b/bragi/thermoprint-server/thermoprint-server.hs | |||
@@ -1,6 +1,5 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | 1 | {-# LANGUAGE OverloadedStrings #-} |
2 | {-# LANGUAGE ImpredicativeTypes #-} | 2 | {-# LANGUAGE ImpredicativeTypes #-} |
3 | {-# LANGUAGE RecordWildCards #-} | ||
4 | 3 | ||
5 | module Main (main) where | 4 | module Main (main) where |
6 | 5 | ||
@@ -21,7 +20,7 @@ import qualified Network.Wai.Handler.Warp as Warp | |||
21 | type ServerM = ReaderT ConnectionPool (LoggingT IO) | 20 | type ServerM = ReaderT ConnectionPool (LoggingT IO) |
22 | 21 | ||
23 | main :: IO () | 22 | main :: IO () |
24 | main = thermoprintServer True (Nat runDb) $ configure (\c -> c{..}) <$> def `withPrinters` printers' | 23 | main = thermoprintServer True (Nat runDb) $ configure <$> def `withPrinters` printers' |
25 | where | 24 | where |
26 | runDb :: ServerM a -> IO a | 25 | runDb :: ServerM a -> IO a |
27 | runDb = runStderrLoggingT . withPostgresqlPool "" 5 . runReaderT | 26 | runDb = runStderrLoggingT . withPostgresqlPool "" 5 . runReaderT |
@@ -29,6 +28,11 @@ main = thermoprintServer True (Nat runDb) $ configure (\c -> c{..}) <$> def `wit | |||
29 | printers' = [ (pure $ genericPrint "/dev/usb/lp0", def :: QMConfig (ResourceT ServerM)) | 28 | printers' = [ (pure $ genericPrint "/dev/usb/lp0", def :: QMConfig (ResourceT ServerM)) |
30 | ] | 29 | ] |
31 | 30 | ||
31 | configure c = c | ||
32 | { queueManagers = queueManagers | ||
33 | , warpSettings = warpSettings | ||
34 | } | ||
35 | |||
32 | queueManagers _ = QMConfig | 36 | queueManagers _ = QMConfig |
33 | { manager = union [ limitHistorySize 100 | 37 | { manager = union [ limitHistorySize 100 |
34 | , limitHistoryAge 3600 | 38 | , limitHistoryAge 3600 |