luckyframework/avram

Allow `Avram::Credentials` to build unix sockets

開放

#986 建立於 2023年11月13日

 (0 則留言) (0 個反應) (0 位負責人)Crystal (67 個分叉)auto 404
hacktoberfesthelp wanted

倉庫指標

星標
 (180 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

If you need to build a unix socket, but want to use the Avram::Credentials object, it's a bit messy. I think we can make this easier to work with.

Here's an example of how to connect with a unix socket

# this ENV must be set otherwise it defaults to the current user's name on the system
# export PGDATABASE=my_db_development
Avram::Credentials.parse("postgresql:///my_db_development?host=/var/lib/postgresql/.s.PGSQL.5432&dbname=my_db_development")

I think you can also set a username and password using

Avram::Credentials.parse("postgresql://user:pass@/my_db_development?host=/var/lib/postgresql/.s.PGSQL.5432&dbname=my_db_development")

We would just need to make sure these methods account for the change

https://github.com/luckyframework/avram/blob/f5b000c26a5d04f54d166939cb1e7c1a3830da83/src/avram/migrator/runner.cr#L49-L59

Related: https://github.com/luckyframework/avram/issues/776

貢獻者指南