Provide command-line flag for db pool size
This commit is contained in:
@@ -49,6 +49,7 @@ data AppConfig = AppConfig {
|
||||
, configPort :: Int
|
||||
, configAnonRole :: String
|
||||
, configSecure :: Bool
|
||||
, configPool :: Int
|
||||
}
|
||||
|
||||
data AuthUser = AuthUser {
|
||||
|
||||
+4
-2
@@ -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) $
|
||||
|
||||
Reference in New Issue
Block a user