feat: Add resolved host to "Listening on ..." messages (#3560)

This adds resolved host's IP to "Listening on ..." messages emitted when
app and admin servers start.
This commit is contained in:
Andrei Dziahel
2024-08-01 11:31:35 -05:00
committed by GitHub
parent 48edab24c6
commit 46537879ae
7 changed files with 45 additions and 8 deletions
+6 -6
View File
@@ -25,9 +25,9 @@ import Protolude
import Protolude.Partial (fromJust)
data Observation
= AdminStartObs (Maybe Int)
= AdminStartObs (Maybe Text) (Maybe Int)
| AppStartObs ByteString
| AppServerPortObs NS.PortNumber
| AppServerPortObs Text NS.PortNumber
| AppServerUnixObs FilePath
| ExitUnsupportedPgVersion PgVersion PgVersion
| ExitDBNoRecoveryObs
@@ -60,12 +60,12 @@ type ObservationHandler = Observation -> IO ()
observationMessage :: Observation -> Text
observationMessage = \case
AdminStartObs port ->
"Admin server listening on port " <> show (fromIntegral (fromJust port) :: Integer)
AdminStartObs host port ->
"Admin server listening on " <> fromJust host <> ":" <> show (fromIntegral (fromJust port) :: Integer)
AppStartObs ver ->
"Starting PostgREST " <> T.decodeUtf8 ver <> "..."
AppServerPortObs port ->
"Listening on port " <> show port
AppServerPortObs host port ->
"Listening on " <> host <> ":" <> show port
AppServerUnixObs sock ->
"Listening on unix socket " <> show sock
DBConnectedObs ver ->