Created
November 12, 2013 22:50
-
-
Save Tritlo/7440273 to your computer and use it in GitHub Desktop.
Heroku helper for haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Helpers.Heroku (herokuConf) where | |
import Prelude | |
import Data.ByteString (ByteString) | |
import Data.Text (Text) | |
import Data.Text.Encoding (encodeUtf8) | |
import Database.Persist.Postgresql (PostgresConf(..)) | |
import Web.Heroku (dbConnParams) | |
import qualified Data.Text as T | |
herokuConf :: IO PostgresConf | |
herokuConf = do | |
params <- dbConnParams | |
return PostgresConf | |
{ pgConnStr = formatParams params | |
, pgPoolSize = 10 -- Adjust this as you see fit! | |
} | |
where | |
formatParams :: [(Text, Text)] -> ByteString | |
formatParams = encodeUtf8 . T.unwords . map toKeyValue | |
toKeyValue :: (Text, Text) -> Text | |
toKeyValue (k, v) = k `T.append` "=" `T.append` v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment