We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f78bd2e commit 8730f04Copy full SHA for 8730f04
lib/pgtk/wire.rb
@@ -61,14 +61,13 @@ class Pgtk::Wire::Env
61
# @param [String] var The name of the environment variable with the connection URL
62
def initialize(var = 'DATABASE_URL')
63
raise "The name of the environment variable can't be nil" if var.nil?
64
- @var = var
+ @value = ENV.fetch(var, nil)
65
+ raise "The environment variable #{@value.inspect} is not set" if @value.nil?
66
end
67
68
# Create a new connection to PostgreSQL server.
69
def connection
- v = ENV.fetch(@var, nil)
70
- raise "The environment variable #{@var.inspect} is not set" if v.nil?
71
- uri = URI(v)
+ uri = URI(@value)
72
Pgtk::Wire::Direct.new(
73
host: CGI.unescape(uri.host),
74
port: uri.port,
0 commit comments