Skip to content

Instantly share code, notes, and snippets.

@myobie
Forked from georgepalmer/gist:44689
Created January 8, 2009 13:45
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 myobie/44726 to your computer and use it in GitHub Desktop.
Save myobie/44726 to your computer and use it in GitHub Desktop.
# 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