connect postgres through a unix socket #307

Closed
opened 2025-12-29 01:26:29 +01:00 by adam · 0 comments
Owner

Originally created by @ratsclub on GitHub (Aug 12, 2022).

Feature request

Ability to connect to postgresql through a unix socket.

Right now we can't do this because of this piece of code hardcodes the port option on the connection string:
09cd7ba304/app.go (L131-L134)

Resulting on this error:

Error initializing error="cannot parse `host=/run/postgresql port=0 dbname=headscale user=headscale password=xxxxx sslmode=disable`: invalid port (outside range)"

When using unix sockets we need at minimum this connection string: user=$USER dbname=$DBNAME host=$SOCKET

Originally created by @ratsclub on GitHub (Aug 12, 2022). <!-- Headscale is a multinational community across the globe. Our common language is English. Please consider raising the feature request in this language. --> **Feature request** <!-- A clear and precise description of what new or changed feature you want. --> Ability to connect to postgresql through a unix socket. Right now we can't do this because of this piece of code hardcodes the `port` option on the connection string: https://github.com/juanfont/headscale/blob/09cd7ba304ec8a9cd683b9ab02ad39899d2128d2/app.go#L131-L134 Resulting on this error: ``` Error initializing error="cannot parse `host=/run/postgresql port=0 dbname=headscale user=headscale password=xxxxx sslmode=disable`: invalid port (outside range)" ``` When using unix sockets we need at minimum this connection string: `user=$USER dbname=$DBNAME host=$SOCKET` <!-- Please include the reason, why you would need the feature. E.g. what problem does it solve? Or which workflow is currently frustrating and will be improved by this? -->
adam added the enhancement label 2025-12-29 01:26:29 +01:00
adam closed this issue 2025-12-29 01:26:29 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#307