Reading External Configuration from Files
External configuration allows a user to control the behavior of an app without using command-line options and arguments, in a more transparent and persistent way. The intent is to give users the ease of use provided by the default behavior but customized for their needs.
As an example, suppose Bob, our sysadmin, is using db_backup.rb to test the effect of changing the settings of a MySQL server. Bob wants to see how these settings affect the speed with which db_backup.rb can complete a backup. Bob is not particularly interested in the backup file that results, only the speed with which it’s produced. To do this, Bob will need to run db_backup.rb like so:
| $ db_backup.rb --username=bob.sysadmin ... |
Get Build Awesome Command-Line Applications in Ruby 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.