Skip to content

Instantly share code, notes, and snippets.

@BRIMIL01
Created March 14, 2011 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BRIMIL01/869296 to your computer and use it in GitHub Desktop.
Save BRIMIL01/869296 to your computer and use it in GitHub Desktop.
Heroku backup configuration for postgres
ENV['DATABASE_URL'] =~ /^postgres\:\/\/([^:]+)\:([^@]+)@([^\/]+)\/(.+)$/
db_config = {
"database" => $4,
"username" => $1,
"password" => $2,
"host" => $3
}
database PostgreSQL do |db|
db.name = db_config["database"]
db.username = db_config["username"]
db.password = db_config["password"]
db.host = db_config["host"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment