Created
May 28, 2011 13:29
-
-
Save sabman/996860 to your computer and use it in GitHub Desktop.
print_spacialdb_params.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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