Class: KamalBackup::Evidence

Inherits:
Object
  • Object
show all
Defined in:
lib/kamal_backup/evidence.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, restic:, redactor:) ⇒ Evidence

Returns a new instance of Evidence.



8
9
10
11
12
# File 'lib/kamal_backup/evidence.rb', line 8

def initialize(config, restic:, redactor:)
  @config = config
  @restic = restic
  @redactor = redactor
end

Instance Method Details

#to_hObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/kamal_backup/evidence.rb', line 14

def to_h
  {
    app_name: @config.app_name,
    generated_at: Time.now.utc.iso8601,
    database_adapter: @config.database_adapter,
    restic_repository: @redactor.redact_string(@config.restic_repository.to_s),
    backup_paths: @config.backup_paths,
    forget_after_backup: @config.forget_after_backup?,
    retention: @config.retention,
    latest_database_backup: latest_snapshot_summary(["type:database"]),
    latest_file_backup: latest_snapshot_summary(["type:files"]),
    last_restic_check: last_check,
    image_version: ENV.fetch("KAMAL_BACKUP_IMAGE_VERSION", VERSION),
    tool_versions: tool_versions
  }
end

#to_json(*args) ⇒ Object



31
32
33
# File 'lib/kamal_backup/evidence.rb', line 31

def to_json(*args)
  JSON.pretty_generate(to_h, *args)
end