config forbid same server-port and admin-server-port (#3559)

* fix: forbid same server-port and admin-server-port

Forbids server-port and admin-server-port from being equal altogether,
despite they might not conflict at all in case admin and app are bound
to different addresses. Implemented as per the discussion at
https://github.com/PostgREST/postgrest/issues/3508#issuecomment-2125123633
This commit is contained in:
Andrei Dziahel
2024-07-03 13:02:02 -05:00
committed by GitHub
parent b9004baa3f
commit 06cbc4be36
4 changed files with 27 additions and 6 deletions
+9
View File
@@ -123,6 +123,15 @@ def test_cli(args, env, use_defaultenv, expect, defaultenv):
assert expect in dump
def test_server_port_and_admin_port_same_value(defaultenv):
"PostgREST should exit with an error message in output if server-port and admin-server-port are the same."
env = {**defaultenv, "PGRST_SERVER_PORT": "3000", "PGRST_ADMIN_SERVER_PORT": "3000"}
with pytest.raises(PostgrestError):
dump = cli(["--dump-config"], env=env).split("\n")
assert "admin-server-port cannot be the same as server-port" in dump
@pytest.mark.parametrize(
"expectedconfig",
[