fix: Panic when attempting to run with unix socket on non-unix host

This commit is contained in:
monacoremo
2021-04-24 19:42:58 +02:00
committed by Remo Rechkemmer
parent 59f0fe5b32
commit 63e0292e23
4 changed files with 17 additions and 13 deletions
+3 -3
View File
@@ -31,8 +31,8 @@ import qualified PostgREST.Config as Config
import Protolude hiding (hPutStrLn)
main :: App.SignalHandlerInstaller -> App.SocketRunner -> CLI -> IO ()
main installSignalHandlers runAppInSocket CLI{cliCommand, cliPath} = do
main :: App.SignalHandlerInstaller -> Maybe App.SocketRunner -> CLI -> IO ()
main installSignalHandlers runAppWithSocket CLI{cliCommand, cliPath} = do
conf@AppConfig{..} <-
either panic identity <$> Config.readAppConfig mempty cliPath Nothing
appState <- AppState.init conf
@@ -47,7 +47,7 @@ main installSignalHandlers runAppInSocket CLI{cliCommand, cliPath} = do
exec :: Command -> AppState -> IO ()
exec CmdDumpConfig appState = putStr . Config.toText =<< AppState.getConfig appState
exec CmdDumpSchema appState = putStrLn =<< dumpSchema appState
exec CmdRun appState = App.run installSignalHandlers runAppInSocket appState
exec CmdRun appState = App.run installSignalHandlers runAppWithSocket appState
-- | Dump DbStructure schema to JSON
dumpSchema :: AppState -> IO LBS.ByteString