aboutsummaryrefslogtreecommitdiff
path: root/Utility/WebApp.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-10 16:02:16 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-10 16:02:16 -0400
commitc931c2137efd59d4f931c75578effa9cfc18854c (patch)
tree74fe000ab70d380be34cc4481de20e5972452b56 /Utility/WebApp.hs
parent30cf4d4df7a4fda22e997366731af910f9996c78 (diff)
use clientSessionBackend2 where available
avoids a warning, which says it's faster
Diffstat (limited to 'Utility/WebApp.hs')
-rw-r--r--Utility/WebApp.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs
index 29daacab1..e7a43eade 100644
--- a/Utility/WebApp.hs
+++ b/Utility/WebApp.hs
@@ -140,9 +140,17 @@ webAppSessionBackend _ = do
Left e -> error $ "failed to generate random key: " ++ show e
Right (s, _) -> case CS.initKey s of
Left e -> error $ "failed to initialize key: " ++ show e
- Right key -> return $ Just $
-
- Yesod.clientSessionBackend key 120
+ Right key -> use key
+ where
+ timeout = 120 * 60 -- 120 minutes
+ use key =
+#if MIN_VERSION_yesod(1,1,7)
+ Just . Yesod.clientSessionBackend2 key . fst
+ <$> Yesod.clientSessionDateCacher timeout
+#else
+ return $ Just $
+ Yesod.clientSessionBackend key timeout
+#endif
{- Generates a random sha512 string, suitable to be used for an
- authentication secret. -}