Closed wayland closed 10 months ago
Hi all! Here's my PR for the servers/x-software stuff. I'm expecting to be told I've done a number of things wrong. I probably won't have a chance to look at the corrections for another week.
Thanks!
Interesting! The tests are failing. They worked on my local (I'm testing with a pretty recent Postgres, though). I note the following error which wasn't present on my local.
The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
I'm not familiar enough with nix to figure out what's going on.
Question: is anyone else able to replicate the test failures on their local?
@wayland Yes, I'm able to replicate the errors locally. (I do realize the CI is not being informative, will fix)
The error happens on pg 14 and 13, the output varies there:
diff -U3 /home/stevechavez/Projects/postgrest-openapi/test/expected/servers.out /home/stevechavez/Projects/postgrest-openapi/output/results/servers.out
--- /home/stevechavez/Projects/postgrest-openapi/test/expected/servers.out 2023-11-04 18:19:12.619939571 -0500
+++ /home/stevechavez/Projects/postgrest-openapi/output/results/servers.out 2023-11-04 18:21:30.704413555 -0500
@@ -53,16 +53,16 @@
-----------------------------------------------------------------------------
[ +
{ +
- "url": "https://www.example.com/api/", +
- "description": "Overriding URL" +
- }, +
- { +
"url": "https://www.example.com/otherapi/?s={s}&browser={browser}",+
"variables": { +
"s": "worms", +
"browser": "none" +
}, +
"description": "Additional URL" +
+ }, +
+ { +
+ "url": "https://www.example.com/api/", +
+ "description": "Overriding URL" +
} +
]
(1 row)
@wayland Just merged https://github.com/PostgREST/postgrest-openapi/pull/23. Once you rebase you should be able to see the diff with the failures.
Thanks! I've added the ORDER BY, so it should work now. Looks like the tests pass now.
HTH,
Thanks for your feedback. I've done some edits in line with what you've suggested. Let me know if there are further issues.
configuration
table -- this can probably be removed once we have a configuration fileservers
table for configuring the Servers block. The table contains a slug and a priority. The Servers block will contain one item for each slug, and will choose the one with the highest priority (see tests for examples).openapi_server_objects
which returns JSON based on the servers tableset_server_from_configuration
, which updates theservers
table based on the configuration valuescallable_root
function which can be directly called by PostgRESTx-software
block, for specifying software versionspgrst.server_host
andpgrst.server_port
(and then called it)servers
andmain