diff --git a/mpbackup b/mpbackup index fd68be8..97cddf2 100644 --- a/mpbackup +++ b/mpbackup @@ -36,7 +36,13 @@ end def do_backup(config) puts "Applying configuration ‘#{config['name']}’ …" ENV['RESTIC_REPOSITORY'] = config['repository'] - ENV['RESTIC_PASSWORD'] = STDIN.getpass('Please put in your restic password: ') + puts "Repository: #{ENV['RESTIC_REPOSITORY']}" + if config['password-file'] + puts "Reading password from file #{config['password-file']} …" + ENV['RESTIC_PASSWORD'] = File.open(config['password-file']) {|f| f.readline} + else + ENV['RESTIC_PASSWORD'] = STDIN.getpass('Please put in your restic password: ') + end puts "Backing up with restic …" # https://restic.readthedocs.io/en/latest/040_backup.html#including-and-excluding-files