Skip to content

Commit

Permalink
Actually use user's ~/.psqlrc file
Browse files Browse the repository at this point in the history
  • Loading branch information
rafbm authored and abrightwell committed Oct 22, 2024
1 parent 9e1c006 commit bf32370
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/cb.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module CB

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

PSQLRC = File.expand_path(ENV["PSQLRC"]? || "~/.psqlrc", home: true)

# Release constants.
BUILD_RELEASE = {{ flag?(:release) }}
SHARDS_VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}
Expand Down
2 changes: 1 addition & 1 deletion src/cb/psql.cr
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module CB
end

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

0 comments on commit bf32370

Please sign in to comment.