Skip to content

Instantly share code, notes, and snippets.

@sabman
Created May 28, 2011 13:29
Show Gist options
  • Select an option

  • Save sabman/996860 to your computer and use it in GitHub Desktop.

Select an option

Save sabman/996860 to your computer and use it in GitHub Desktop.
print_spacialdb_params.rb
#!/usr/bin/env ruby
# SPACIALDB_USER=username
# SPACIALDB_DB=dbname
# SPACIALDB_PASS=passwd
# SPACIALDB_HOST=beta.spacialdb.com
# SPACIALDB_PORT=9999
url = ENV["SPACIALDB_URL"]
regex = Regexp.new(/(.*):\/\/(.*):(.*)@(.*):([\d]{3,5})\/(.*)/)
matchdata = regex.match(url)
puts "export SPACIALDB_USER=#{matchdata[2]}"
puts "export SPACIALDB_PASS=#{matchdata[3]}"
puts "export SPACIALDB_HOST=#{matchdata[4]}"
puts "export SPACIALDB_PORT=#{matchdata[5]}"
puts "export SPACIALDB_DB=#{matchdata[6]}"
# # To Run:
# $ heroku config
# BUNDLE_WITHOUT => development:test
# DATABASE_URL => postgres://xxx:xxx@ec2-50-16-215-157.compute-1.amazonaws.com/wlfsnmjxju
# LANG => en_US.UTF-8
# RACK_ENV => production
# SHARED_DATABASE_URL => postgres://xxx:xxx@ec2-50-16-215-157.compute-1.amazonaws.com/wlfsnmjxju
# SPACIALDB_STATUS => active
# SPACIALDB_URL => postgres://xxx:xxx@beta.spacialdb.com:9999/heroku_shoaib_burq_517e
# $ SPACIALDB_URL=postgres://xxx:xxx@beta.spacialdb.com:9999/heroku_shoaib_burq_517e ./setup_spacialdb_params.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment