Skip to content
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

Allow connecting to PostgreSQL via unix socket #580

Closed
giodamelio opened this issue Mar 11, 2024 · 1 comment
Closed

Allow connecting to PostgreSQL via unix socket #580

giodamelio opened this issue Mar 11, 2024 · 1 comment
Labels
feature New feature or request

Comments

@giodamelio
Copy link

Is your feature request related to a problem? Please describe.
I would like to be able to connect to PostgreSQL via a unix socket with peer auth. It is more secure and easier when not running inside Docker since there are no open network sockets needed, and no passwords (if you don't want).

Describe the solution you'd like
sqlx already supports connecting via socket (See PgConnectOptions::host()), so this would mostly be a change to the configuration system.

Additional context
I would love to contribute a patch for this, I would mostly just like guidance on the config changes.

@giodamelio giodamelio added the feature New feature or request label Mar 11, 2024
@giodamelio
Copy link
Author

After a bit more playing around, it seems that you can just set DEFGUARD_DB_HOST to the path /run/postgresql (or wherever your Unix Socket is located) and leave the other variables empty. Since none of them are required it seems to work fine. The key is that the path must begin with /.

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

No branches or pull requests

1 participant