Skip to content

Instantly share code, notes, and snippets.

@berkes
Created August 31, 2013 10:40
Show Gist options
  • Save berkes/6397463 to your computer and use it in GitHub Desktop.
Save berkes/6397463 to your computer and use it in GitHub Desktop.
Add chapter about how to pass in arbitrary variables. This closes #478
diff --git a/Performing-Backups.md b/Performing-Backups.md
index d5e1511..472e9a2 100644
--- a/Performing-Backups.md
+++ b/Performing-Backups.md
@@ -191,6 +191,24 @@ The `backup perform` command will exit with the following status codes:
**2**: All triggers were _processed_, but some failed.
**3**: A fatal error caused Backup to exit. Some triggers may not have been processed.
+Passing Arbitrary Variables
+---------------------------
+
+If you wish to pass in parameters other then the predefined Command Line
+Options, you can do so using environment-variables. For example:
+
+ $ DB_NAME=my_app_production backup perform --trigger my_backup
+
+Then, you can access these in the `my_backup.rb` model:
+
+ Backup::Model.new(:my_backup, 'Description for my_backup') do
+ database MongoDB do |db|
+ db.name = ENV["DB_NAME"] || "default_name"
+ #...
+ end
+ end
+
+This allows for a more dynamic backup-plan.
[Archives]: Archives
[Cycling]: Cycling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment