feat: show PostgREST version in the logs
This commit is contained in:
@@ -273,6 +273,7 @@ internalConnectionWorker appState = work
|
|||||||
where
|
where
|
||||||
work = do
|
work = do
|
||||||
AppConfig{..} <- getConfig appState
|
AppConfig{..} <- getConfig appState
|
||||||
|
logWithZTime appState $ "Starting PostgREST " <> T.decodeUtf8 prettyVersion <> "..."
|
||||||
logWithZTime appState "Attempting to connect to the database..."
|
logWithZTime appState "Attempting to connect to the database..."
|
||||||
connected <- establishConnection appState
|
connected <- establishConnection appState
|
||||||
case connected of
|
case connected of
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ def run(
|
|||||||
host=None,
|
host=None,
|
||||||
wait_for_readiness=True,
|
wait_for_readiness=True,
|
||||||
no_pool_connection_available=False,
|
no_pool_connection_available=False,
|
||||||
|
no_startup_stdout=True,
|
||||||
):
|
):
|
||||||
"Run PostgREST and yield an endpoint that is ready for connections."
|
"Run PostgREST and yield an endpoint that is ready for connections."
|
||||||
|
|
||||||
@@ -104,7 +105,8 @@ def run(
|
|||||||
if wait_for_readiness:
|
if wait_for_readiness:
|
||||||
wait_until_ready(adminurl + "/ready")
|
wait_until_ready(adminurl + "/ready")
|
||||||
|
|
||||||
process.stdout.read()
|
if no_startup_stdout:
|
||||||
|
process.stdout.read()
|
||||||
|
|
||||||
if no_pool_connection_available:
|
if no_pool_connection_available:
|
||||||
sleep_pool_connection(baseurl, 10)
|
sleep_pool_connection(baseurl, 10)
|
||||||
|
|||||||
@@ -1039,3 +1039,15 @@ def test_get_pgrst_version_with_keyval_connection_string(defaultenv):
|
|||||||
"postgrest/", "PostgREST "
|
"postgrest/", "PostgREST "
|
||||||
)
|
)
|
||||||
assert response.text == version
|
assert response.text == version
|
||||||
|
|
||||||
|
|
||||||
|
def test_log_postgrest_version(defaultenv):
|
||||||
|
"Should show the PostgREST version in the logs"
|
||||||
|
|
||||||
|
with run(env=defaultenv, no_startup_stdout=False) as postgrest:
|
||||||
|
version = postgrest.session.head("/").headers["Server"].split("/")[1]
|
||||||
|
|
||||||
|
assert (
|
||||||
|
"Starting PostgREST %s..." % version
|
||||||
|
in postgrest.process.stdout.readline().decode()
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user