Created
January 8, 2009 11:22
-
-
Save georgepalmer/44689 to your computer and use it in GitHub Desktop.
Rails initializer for CouchDB
This file contains 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
# Rails initializer for CouchDB | |
begin | |
config = YAML::load(File.open('config/couchdb.yml')) | |
rescue | |
puts "ERROR: Could not read config/couchdb.yml" | |
exit(1) | |
end | |
begin | |
RelaxDB.configure(config[RAILS_ENV]) | |
RelaxDB.use_db(config[RAILS_ENV][:db]) | |
puts "RelaxDB connected to CouchDB #{RelaxDB.db.uri}" | |
rescue => e | |
uri = RelaxDB.db ? RelaxDB.db.uri : "<initialisation error>" | |
puts "RelaxDB could not connect to CouchDB at #{uri} due to error #{e}: \n#{e.backtrace.join("\n")}" | |
exit(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment