Skip to content

Commit bf32370

Browse files
rafbmabrightwell
authored andcommitted
Actually use user's ~/.psqlrc file
1 parent 9e1c006 commit bf32370

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/cb.cr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ module CB
1414

1515
DASHBOARD_HOST = ENV["CB_DASHBOARD_HOST"]? || HOST.gsub(/\Aapi\./, "")
1616

17+
PSQLRC = File.expand_path(ENV["PSQLRC"]? || "~/.psqlrc", home: true)
18+
1719
# Release constants.
1820
BUILD_RELEASE = {{ flag?(:release) }}
1921
SHARDS_VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}

src/cb/psql.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module CB
9595
end
9696

9797
psqlrc = File.tempfile(c.id, "psqlrc")
98-
File.copy("~/.psqlrc", psqlrc.path) if File.exists?("~/.psqlrc")
98+
File.copy(CB::PSQLRC, psqlrc.path) if File.exists?(CB::PSQLRC)
9999
File.open(psqlrc.path, "a") do |f|
100100
f.puts "\\set ON_ERROR_ROLLBACK interactive"
101101
f.puts "\\set PROMPT1 '#{psqlpromptname}/%[%033[33;1m%]%x%x%x%[%033[0m%]%[%033[1m%]%/%[%033[0m%]%R%# '"

0 commit comments

Comments
 (0)