WIP: Resolve "It's not possible to set bundled postgres to listen on an IP/Port"
Closes #2597.
This fixes the issue by omitting unix_socket_directory
from postgresql.conf
if a listen_address
is specified.
If the user specifies both, listen_address
takes precedence. This has been documented in files/gitlab-cookbooks/gitlab/recipes/default.rb
.
My rationale here is simply that adding a listen_address
requires two attribute changes, while changing unix_socket_directory
only requires one. If someone is intent on changing the unix socket, they'll probably leave listen_address
alone. On the other hand, if someone wants to listen on localhost, they might not know to set the socket value to nil as well.
I have also added tests which validate this behavior. I wasn't exactly sure where to place the "correctly sets unix_socket_directory" test, since one could argue that it belongs in either the 'with default settings' or the 'version specific settings' contexts. I put it in the latter, since that's where it lives in the 9.6 block. Let me know if it should go someplace else. I also moved the socket test inside the renders postgresql.conf
context in the 9.6 block in order to mirror the 9.2 block. There's a bit of repeated code here, so I'm thinking it might be possible to optimize readability a bit.