diff --git a/hledger-web/Application.hs b/hledger-web/Application.hs index 881d9fa70..112aa209f 100644 --- a/hledger-web/Application.hs +++ b/hledger-web/Application.hs @@ -11,7 +11,21 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger (logStdoutDev, logStdout) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager) + +-- adapt to http-conduit 1.x or 2.x when cabal macros are available, otherwise assume 2.x +#ifdef MIN_VERSION_http_conduit +#if MIN_VERSION_http_conduit(2,0,0) +#define http_conduit_2 +#endif +#else +#define http_conduit_2 +#endif +#ifdef http_conduit_2 +import Network.HTTP.Client (defaultManagerSettings) +#else +import Network.HTTP.Conduit (def) +#endif -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -49,7 +63,12 @@ makeApplication opts j conf = do makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager +#ifdef http_conduit_2 + defaultManagerSettings +#else + def +#endif s <- staticSite jref <- newIORef nulljournal return $ App conf s manager defwebopts jref diff --git a/hledger-web/hledger-web.cabal b/hledger-web/hledger-web.cabal index 6633bf116..779f77f4c 100644 --- a/hledger-web/hledger-web.cabal +++ b/hledger-web/hledger-web.cabal @@ -121,6 +121,7 @@ library , hamlet , hjsmin , http-conduit + , http-client >= 0.2 && < 0.3 , HUnit , network-conduit , old-locale @@ -212,6 +213,7 @@ executable hledger-web , hamlet , hjsmin , http-conduit + , http-client >= 0.2 && < 0.3 , HUnit , network-conduit , old-locale