meskyanichi/backup — Issue #212: Using uri in Mongodb backup model
Author: uoksana
Created: 2011-11-12 16:54:49+00:00
State: open

Is it passable using uri in Backup:Model for MongoDB?

Like this:

require 'yaml'
database_yml = File.expand_path('../config/mongoid.yml', __FILE__)
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
config = YAML.load_file(database_yml)

Backup::Model.new(:db_backup, 'database backup') do
database MongoDB do |db|
db.uri = config[RAILS_ENV]["uri"]
db.only_collections = ['locations', 'tariffs' 'trips','users']
db.additional_options = []
db.lock = false
end

store_with Dropbox do |db|
db.email = 'foo@email'
db.password = 'password'
db.api_key = 'api key'
db.api_secret = 'secret'
db.timeout = 300
db.path = '/myapp'
db.keep = 25
end

##
# Gzip [Compressor]
#
compress_with Gzip do |compression|
compression.best = true
compression.fast = false
end
end

mongoid.yml

production:
# <<: *defaults
# <<: *defaults
uri: <%= ENV['MONGOLAB_URI'] %>