mirror of
https://codeberg.org/puppe/mpbackup.git
synced 2025-12-20 05:52:18 +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
6
mpbackup
6
mpbackup
|
|
@ -36,7 +36,13 @@ end
|
||||||
def do_backup(config)
|
def do_backup(config)
|
||||||
puts "Applying configuration ‘#{config['name']}’ …"
|
puts "Applying configuration ‘#{config['name']}’ …"
|
||||||
ENV['RESTIC_REPOSITORY'] = config['repository']
|
ENV['RESTIC_REPOSITORY'] = config['repository']
|
||||||
|
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: ')
|
ENV['RESTIC_PASSWORD'] = STDIN.getpass('Please put in your restic password: ')
|
||||||
|
end
|
||||||
|
|
||||||
puts "Backing up with restic …"
|
puts "Backing up with restic …"
|
||||||
# https://restic.readthedocs.io/en/latest/040_backup.html#including-and-excluding-files
|
# https://restic.readthedocs.io/en/latest/040_backup.html#including-and-excluding-files
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue