Class: KamalBackup::Evidence
- Inherits:
-
Object
- Object
- KamalBackup::Evidence
- Defined in:
- lib/kamal_backup/evidence.rb
Instance Method Summary collapse
-
#initialize(config, restic:, redactor:) ⇒ Evidence
constructor
A new instance of Evidence.
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(config, restic:, redactor:) ⇒ Evidence
Returns a new instance of Evidence.
11 12 13 14 15 |
# File 'lib/kamal_backup/evidence.rb', line 11 def initialize(config, restic:, redactor:) @config = config @restic = restic @redactor = redactor end |
Instance Method Details
#to_h ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kamal_backup/evidence.rb', line 17 def to_h Schema.record( kind: 'evidence', app_name: @config.app_name, generated_at: Time.now.utc.iso8601, databases: @config.databases.map do |database| { name: database.database_name, adapter: database.database_adapter } end, restic_repository: @redactor.redact_string(@config.restic_repository.to_s), paths: @config.backup_paths, forget_after_backup: @config.forget_after_backup?, retention: @config.retention, latest_database_backups: latest_database_backups, latest_file_backup: latest_snapshot_summary(['type:files']), last_restic_check: last_check, last_restore_drill: last_restore_drill, image_version: VERSION, tool_versions: tool_versions ) end |
#to_json(*args) ⇒ Object
38 39 40 |
# File 'lib/kamal_backup/evidence.rb', line 38 def to_json(*args) JSON.pretty_generate(to_h, *args) end |