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
+4 -3
View File
@@ -65,12 +65,13 @@ import PostgREST.Types
import Protolude hiding (Proxy, intercalate, toS)
import Protolude.Conv (toS)
postgrest :: LogSetup -> AppConfig -> IORef (Maybe DbStructure) -> P.Pool -> IO UTCTime -> IO () -> Application
postgrest logs conf refDbStructure pool getTime worker =
pgrstMiddleware logs $ \ req respond -> do
postgrest :: LogSetup -> IORef AppConfig -> IORef (Maybe DbStructure) -> P.Pool -> IO UTCTime -> IO () -> Application
postgrest logS refConf refDbStructure pool getTime worker =
pgrstMiddleware logS $ \ req respond -> do
time <- getTime
body <- strictRequestBody req
maybeDbStructure <- readIORef refDbStructure
conf <- readIORef refConf
case maybeDbStructure of
Nothing -> respond . errorResponseFor $ ConnectionLostError
Just dbStructure -> do