Skip to content

Add a way to connect through UNIX socket. #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apognu
Copy link

@apognu apognu commented Mar 3, 2025

This PR adds the ability to instruct Postgres to listen on UNIX sockets instead of on a TCP port.

It adds a WithoutTcp() method to the configuration to make the switch. By default, it follows Postgres's default to creating the socket in /tmp, but the socket path can be customized through WithUnixSocketDirectory(dir string).

It modifies the config's GetConnectionURL() to take the current mode of connection into account, and adds a public GetConnectionURL() method on EmbeddedPostgres to proxy it (I would have preferred for those to return *url.URLs, but did not want to change the signature of public methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant