Provide command-line flag for db pool size

This commit is contained in:
Joe Nelson
2014-10-21 16:15:11 -07:00
parent 563187f3c0
commit 32e3396caf
4 changed files with 7 additions and 4 deletions
+1
View File
@@ -49,6 +49,7 @@ data AppConfig = AppConfig {
, configPort :: Int
, configAnonRole :: String
, configSecure :: Bool
, configPool :: Int
}
data AuthUser = AuthUser {
+4 -2
View File
@@ -26,12 +26,14 @@ argParser = AppConfig
<*> strOption (long "anonymous" <> short 'a' <> metavar "ROLE"
<> help "postgres role to use for non-authenticated requests")
<*> switch (long "secure" <> short 's'
<> help "Redirect all requests to HTTPS" )
<> help "Redirect all requests to HTTPS")
<*> option (long "db-pool" <> metavar "NUMBER" <> value 10
<> help "Max connections in database pool")
main :: IO ()
main = do
conf <- execParser (info (helper <*> argParser) describe)
pool <- createPool (connectPostgreSQL' (configDbUri conf)) disconnect 1 600 10
pool <- createPool (connectPostgreSQL' (configDbUri conf)) disconnect 1 600 (configPool conf)
let port = configPort conf
unless (configSecure conf) $