Add db-prepared-statements config

This commit is contained in:
steve-chavez
2020-11-23 19:00:50 -05:00
committed by Steve Chavez
parent 4bd5e6bd82
commit 787973f323
9 changed files with 55 additions and 40 deletions
+7
View File
@@ -100,6 +100,8 @@ data AppConfig = AppConfig {
, configTxRollbackAll :: Bool
, configTxAllowOverride :: Bool
, configDbPrepared :: Bool
}
configPoolTimeout' :: (Fractional a) => AppConfig -> a
@@ -179,6 +181,10 @@ readPathShowHelp = customExecParser parserPrefs opts
|## transaction is rolled back, but can be overriden with Prefer tx=commit header
|db-tx-end = "commit"
|
|## enable or disable prepared statements. disabling is only necessary when behind a connection pooler.
|## when disabled, statements will be parametrized but won't be prepared.
|db-prepared-statements = true
|
|server-host = "!4"
|server-port = 3000
|
@@ -263,6 +269,7 @@ readAppConfig cfgPath = do
<*> parseLogLevel "log-level"
<*> parseTxEnd "db-tx-end" fst
<*> parseTxEnd "db-tx-end" snd
<*> (fromMaybe True <$> optBool "db-prepared-statements")
parseSocketFileMode :: C.Key -> C.Parser C.Config (Either Text FileMode)
parseSocketFileMode k =