* Add test for ensuring app.settings don't reset
This commit is contained in:
+2
-8
@@ -7,8 +7,7 @@ import PostgREST.App (postgrest)
|
||||
import PostgREST.Config (AppConfig (..),
|
||||
minimumPgVersion,
|
||||
prettyVersion, readOptions)
|
||||
import PostgREST.DbStructure (getDbStructure, getPgVersion,
|
||||
fillSessionWithSettings)
|
||||
import PostgREST.DbStructure (getDbStructure, getPgVersion)
|
||||
import PostgREST.Error (encodeError)
|
||||
import PostgREST.OpenAPI (isMalformedProxyUri)
|
||||
import PostgREST.Types (DbStructure, Schema, PgVersion(..))
|
||||
@@ -63,11 +62,10 @@ connectionWorker
|
||||
:: ThreadId -- ^ This thread is killed if pg version is unsupported
|
||||
-> P.Pool -- ^ The PostgreSQL connection pool
|
||||
-> Schema -- ^ Schema PostgREST is serving up
|
||||
-> [(Text, Text)] -- ^ Settings or Environment passed in through the config
|
||||
-> IORef (Maybe DbStructure) -- ^ mutable reference to 'DbStructure'
|
||||
-> IORef Bool -- ^ Used as a binary Semaphore
|
||||
-> IO ()
|
||||
connectionWorker mainTid pool schema settings refDbStructure refIsWorkerOn = do
|
||||
connectionWorker mainTid pool schema refDbStructure refIsWorkerOn = do
|
||||
isWorkerOn <- readIORef refIsWorkerOn
|
||||
unless isWorkerOn $ do
|
||||
atomicWriteIORef refIsWorkerOn True
|
||||
@@ -85,7 +83,6 @@ connectionWorker mainTid pool schema settings refDbStructure refIsWorkerOn = do
|
||||
("Cannot run in this PostgreSQL version, PostgREST needs at least "
|
||||
<> pgvName minimumPgVersion)
|
||||
killThread mainTid
|
||||
fillSessionWithSettings settings
|
||||
dbStructure <- getDbStructure schema actualPgVersion
|
||||
liftIO $ atomicWriteIORef refDbStructure $ Just dbStructure
|
||||
case result of
|
||||
@@ -184,7 +181,6 @@ main = do
|
||||
mainTid
|
||||
pool
|
||||
(configSchema conf)
|
||||
(configSettings conf)
|
||||
refDbStructure
|
||||
refIsWorkerOn
|
||||
--
|
||||
@@ -208,7 +204,6 @@ main = do
|
||||
mainTid
|
||||
pool
|
||||
(configSchema conf)
|
||||
(configSettings conf)
|
||||
refDbStructure
|
||||
refIsWorkerOn
|
||||
) Nothing
|
||||
@@ -229,7 +224,6 @@ main = do
|
||||
mainTid
|
||||
pool
|
||||
(configSchema conf)
|
||||
(configSettings conf)
|
||||
refDbStructure
|
||||
refIsWorkerOn)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user