lib/backup_repos/config.rb in backup_repos-0.4.0 vs lib/backup_repos/config.rb in backup_repos-0.5.0
- old
+ new
@@ -45,13 +45,14 @@
def respond_to_missing?(name, include_private = false)
options.respond_to?(name) || config.key?(name.to_s) || super
end
def config_file
- return File.join(Dir.home, '.backup-repos') if options.config_path.blank?
+ return File.expand_path(ENV['CONFIG_PATH']) if ENV['CONFIG_PATH'].present?
+ return File.expand_path(options.config_file) if options.config_file.present?
- File.expand_path(options.config_path)
+ File.join(Dir.home, '.backup-repos')
end
def dig(*args)
config.dig(*args)
end
@@ -67,9 +68,11 @@
@file_config ||= (YAML.load_file(config_file) || {})
end
def backup_root_dir
+ return File.expand_path(ENV['BACKUP_DIR']) if ENV['BACKUP_DIR'].present?
+
options.backup_root || config['backup_root']
end
end
end