2020-11-05 18:36:07 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
require 'uri'
|
|
|
|
|
|
|
|
# Let DATABASE_URL env take presedence over individual connection params.
|
|
|
|
if !ENV['DATABASE_URL'].nil? && ENV['DATABASE_URL'] != ''
|
2022-07-15 02:51:59 +00:00
|
|
|
uri = URI(ENV.fetch('DATABASE_URL', nil))
|
2020-11-05 18:36:07 +00:00
|
|
|
puts "export POSTGRES_HOST=#{uri.host} POSTGRES_PORT=#{uri.port} POSTGRES_USERNAME=#{uri.user}"
|
2021-08-03 17:26:55 +00:00
|
|
|
elsif ENV['POSTGRES_PORT'].nil? || ENV['POSTGRES_PORT'] == ''
|
|
|
|
puts 'export POSTGRES_PORT=5432'
|
2021-07-28 14:06:51 +00:00
|
|
|
end
|