Skip to content

Instantly share code, notes, and snippets.

@robertsosinski
Created May 13, 2012 00:50
Show Gist options
  • Save robertsosinski/2669987 to your computer and use it in GitHub Desktop.
Save robertsosinski/2669987 to your computer and use it in GitHub Desktop.
Setup Database URL for QueueClassic
db_config = config.database_configuration[Rails.env]
scheme = db_config['adapter']
userinfo = [db_config['username'], db_config['password']].compact.join(':')
host = db_config['host'] || 'localhost'
port = db_config['port'] || 5432
database = db_config['database']
ENV['QC_DATABASE_URL'] = ENV['DATABASE_URL'] = URI::Generic.new(scheme, userinfo, host, port, nil, "/#{database}", nil, nil, nil).to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment