Optionally read repository from file

This commit is contained in:
Martin Puppe 2020-03-26 12:08:52 +01:00
parent 9e3a9f27ff
commit dc53973745

View file

@ -9,8 +9,14 @@ NAME = 'mpbackup'
VERSION = '0.3.0' VERSION = '0.3.0'
def set_restic_vars(config) def set_restic_vars(config)
if config['repository-file']
puts "Reading repository from file #{config['repository-file']} …"
repo = File.open(config['repository-file'], &:gets).chomp
elsif config['repository']
repo = config['repository'] repo = config['repository']
puts "Repository: #{repo}" else
error(1, 'No repository has been specified.')
end
if config['password-file'] if config['password-file']
puts "Reading password from file #{config['password-file']} …" puts "Reading password from file #{config['password-file']} …"
password = File.open(config['password-file'], &:gets).chomp password = File.open(config['password-file'], &:gets).chomp