Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.