Skip to content

Commit

Permalink
Backend/feat: ##93 Add cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
shanm-16 committed Apr 25, 2023
1 parent 1cbba86 commit 6f464de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/mobility-core/src/Kernel/Storage/Esqueleto/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ data EsqDBConfig = EsqDBConfig
connectUser :: Text,
connectPassword :: Text,
connectDatabase :: Text,
connectSchemaName :: Text
connectSchemaName :: Text,
connectionPoolSize :: Int
}
deriving (Generic, Show, ToJSON, FromJSON, FromDhall)

Expand All @@ -45,11 +46,12 @@ prepareEsqDBEnv :: EsqDBConfig -> LoggerEnv -> IO EsqDBEnv
prepareEsqDBEnv cfg logEnv = do
let connStr = makeConnString cfg
modifyConnString = encodeUtf8 cfg.connectSchemaName
connectionPoolSize = cfg.connectionPoolSize
let checkedLogEnv =
if logEnv.logRawSql
then logEnv
else logEnv {fileLogger = Nothing, consoleLogger = Nothing}
pool <- liftIO . runLoggerIO checkedLogEnv $ createPostgresqlPoolModified (modifyConn modifyConnString) connStr 10
pool <- liftIO . runLoggerIO checkedLogEnv $ createPostgresqlPoolModified (modifyConn modifyConnString) connStr connectionPoolSize
return $ EsqDBEnv pool
where
makeConnString dbConfig =
Expand Down

0 comments on commit 6f464de

Please sign in to comment.