Allow config file reloading with SIGUSR2

* move config validation to Config.hs
* Add tests for jwt-secret/app.settings.*/db-schema reload
This commit is contained in:
steve-chavez
2020-07-13 11:30:16 -05:00
committed by Steve Chavez
parent e272ea47be
commit e8b4e3771c
8 changed files with 172 additions and 53 deletions
+5 -2
View File
@@ -65,12 +65,15 @@ main = do
let
-- For tests that run with the same refDbStructure
app cfg = return ((), postgrest LogQuiet (cfg testDbConn) refDbStructure pool getTime $ pure ())
app cfg = do
refConf <- newIORef $ cfg testDbConn
return ((), postgrest LogQuiet refConf refDbStructure pool getTime $ pure ())
-- For tests that run with a different DbStructure(depends on configSchemas)
appDbs cfg = do
dbs <- (newIORef . Just) =<< setupDbStructure pool (configSchemas $ cfg testDbConn) actualPgVersion
return ((), postgrest LogQuiet (cfg testDbConn) dbs pool getTime $ pure ())
refConf <- newIORef $ cfg testDbConn
return ((), postgrest LogQuiet refConf dbs pool getTime $ pure ())
let withApp = app testCfg
maxRowsApp = app testMaxRowsCfg