Skip to content

Commit

Permalink
Remove DB_URL constant. Parse URL directly in connection object.
Browse files Browse the repository at this point in the history
  • Loading branch information
glenngillen committed Apr 11, 2012
1 parent 6057420 commit 2629f2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 0 additions & 5 deletions lib/queue_classic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/queue_classic/conn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2629f2a

Please sign in to comment.