Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change backup_mailer parameters to be configured by application const…

…ants
  • Loading branch information...
commit c4c3d7b199ff372412d2483e565f040e1220c71b 1 parent 9543c1b
@lazylester authored
View
8 README.rdoc
@@ -28,3 +28,11 @@ The location of the backup files is defined by the global constant BACKUP_DIR. T
Suggest keeping backup files in a location that will survive code updates, for example in a typical Capistrano configuration there might be a 'shared' directory. Include in the main application an initializer in config/initializers with the following:
BACKUP_DIR = Rails.env.production? ? Rails.root.join("../../shared/backups") : "#{Rails.root}/db/backups/"
+
+If it is intended to use the rake tasks for periodically emailing the backup file (e.g. driven by cron), the following global constants must be defined in your application:
+ BACKUP_RECIPIENTS (text string in the format "firstname lastname<email@domain.com>")
+ ORGANIZATION_NAME (text string, name of the application owner organization)
+ ADMIN_EMAIL (text string, for example: "support@domain.com")
+ SITE_URL (text string, for example "domain.com")
+
+
View
8 app/models/backup_mailer.rb
@@ -1,9 +1,9 @@
class BackupMailer < ActionMailer::Base
def backup_file(zipfile)
- recipients 'Les Nightingill<les@stillpointoftheturningworld.com>'
- from "ORI Database Administrator<#{ADMIN_EMAIL}>"
- headers "Reply-to" => "#{ADMIN_EMAIL}", "Message-ID"=>"<#{DateTime.now.to_formatted_s(:number)}@orphansofrwanda.info>"
- subject "ORI daily backup file"
+ recipients BACKUP_RECIPIENTS
+ from "#{ORGANIZATION_NAME} Database Administrator<#{ADMIN_EMAIL}>"
+ headers "Reply-to" => "#{ADMIN_EMAIL}", "Message-ID"=>"<#{DateTime.now.to_formatted_s(:number)}@#{SITE_URL}>"
+ subject "#{ORGANIZATION_NAME} daily backup file"
attachment :content_type => "application/x-gzip", :body => zipfile, :filename => DateTime.now.to_formatted_s(:db)+"_production_backup.zip"
end
end
View
4 lib/tasks/get_back_tasks.rake
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :get_back do
-# # Task goes here
-# end
Please sign in to comment.
Something went wrong with that request. Please try again.