Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/pq/pgpass_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe PQ::PgPass, ".parsing" do
create_valid_pgpass_file do |filename|
File.chmod(filename, 0o0700)
ENV["PGPASSFILE"] = filename
Log.capture {
Log.capture("pg") {
ci = PQ::ConnInfo.from_conninfo_string("postgres://")
}.itself
.check(:warn, "Cannot use pgpass file - permissions are inappropriate must be 0600 or less")
Expand All @@ -70,7 +70,7 @@ describe PQ::PgPass, ".parsing" do
env_var_bubble do
create_invalid_pgpass_file do |filename|
ENV["PGPASSFILE"] = filename
Log.capture {
Log.capture("pg") {
ci = PQ::ConnInfo.from_conninfo_string("postgres://")
}.itself
.check(:warn, "PGPass file does not appear to be properly formatted - errors may occur")
Expand Down
2 changes: 2 additions & 0 deletions src/pq/pgpass.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module PQ
Log = ::Log.for("pg")

class PgPass
def self.locate(host : String, port : Int, db : String, user : String) : String?
filename = ENV.fetch("PGPASSFILE", Path["~/.pgpass"].expand(home: true).to_s)
Expand Down