Permalink
Browse files

Merge pull request #24 from szetobo/master

delay evaluation of environment variables in the database class
  • Loading branch information...
2 parents e5ca645 + 4b954b1 commit 9f3ad22c8804d87d17edc43e14dbaf56301bc4bf Ryan Smith (ace hacker) committed Nov 26, 2011
Showing with 9 additions and 8 deletions.
  1. +9 −8 lib/queue_classic/database.rb
@@ -3,28 +3,29 @@ class Database
@@connection = nil
- DATABASE_URL = (ENV["QC_DATABASE_URL"] || ENV["DATABASE_URL"])
- MAX_TOP_BOUND = (ENV["QC_TOP_BOUND"] || 9).to_i
- NOTIFY_TIMEOUT = (ENV["QC_NOTIFY_TIMEOUT"] || 10).to_i
- DEFAULT_QUEUE_NAME = "queue_classic_jobs"
+ # DATABASE_URL = (ENV["QC_DATABASE_URL"] || ENV["DATABASE_URL"])
+ # MAX_TOP_BOUND = (ENV["QC_TOP_BOUND"] || 9).to_i
+ # NOTIFY_TIMEOUT = (ENV["QC_NOTIFY_TIMEOUT"] || 10).to_i
+ # DEFAULT_QUEUE_NAME = "queue_classic_jobs"
attr_reader :table_name
attr_reader :top_boundary
def initialize(queue_name=nil)
log("initialized")
- @top_boundary = MAX_TOP_BOUND
+ @top_boundary = (ENV["QC_TOP_BOUND"] || 9).to_i
log("top_boundary=#{@top_boundary}")
- @table_name = queue_name || DEFAULT_QUEUE_NAME
+ @table_name = queue_name || "queue_classic_jobs"
log("table_name=#{@table_name}")
@channel_name = @table_name
log("channel_name=#{@channel_name}")
- @db_params = URI.parse(DATABASE_URL)
- log("uri=#{DATABASE_URL}")
+ db_url = (ENV["QC_DATABASE_URL"] || ENV["DATABASE_URL"])
+ @db_params = URI.parse(db_url)
+ log("uri=#{db_url}")
end
def set_application_name

0 comments on commit 9f3ad22

Please sign in to comment.