Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #56 from glenngillen/master

Lazy evaluate database URL
  • Loading branch information...
commit 0ac05e53ce977248a2b2c1765b10c2d90856ef3f 2 parents 6057420 + 2629f2a
♠ ace hacker authored
Showing with 5 additions and 6 deletions.
  1. +0 −5 lib/queue_classic.rb
  2. +5 −1 lib/queue_classic/conn.rb
View
5 lib/queue_classic.rb
@@ -18,11 +18,6 @@ module QC
SqlFunctions = File.join(QC::Root, "/sql/ddl.sql")
DropSqlFunctions = File.join(QC::Root, "/sql/drop_ddl.sql")
- DB_URL =
- ENV["QC_DATABASE_URL"] ||
- ENV["DATABASE_URL"] ||
- raise(ArgumentError, "missing QC_DATABASE_URL or DATABASE_URL")
-
# You can use the APP_NAME to query for
# postgres related process information in the
# pg_stat_activity table. Don't set this unless
View
6 lib/queue_classic/conn.rb
@@ -84,7 +84,11 @@ def connect
end
def db_url
- URI.parse(DB_URL)
+ return @db_url if @db_url
+ url = ENV["QC_DATABASE_URL"] ||
+ ENV["DATABASE_URL"] ||
+ raise(ArgumentError, "missing QC_DATABASE_URL or DATABASE_URL")
+ @db_url = URI.parse(url)
end
def log(msg)
Please sign in to comment.
Something went wrong with that request. Please try again.