mirror of
https://codeberg.org/puppe/mpbackup.git
synced 2025-12-19 21:42:17 +01:00
Optionally read password from file
This commit is contained in:
parent
19f2c23659
commit
95d13588ba
1 changed files with 7 additions and 1 deletions
8
mpbackup
8
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue