From 4618b97a5ee76a9b7bf469ff5d10d8ccacbce011 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 9 Sep 2018 13:20:10 +0200 Subject: Get settings via hash instead of direct variable access Signed-off-by: Florian Pritz --- lib/App/BorgRestore/Settings.pm | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'lib/App/BorgRestore') diff --git a/lib/App/BorgRestore/Settings.pm b/lib/App/BorgRestore/Settings.pm index 2aea1ae..81c2cac 100644 --- a/lib/App/BorgRestore/Settings.pm +++ b/lib/App/BorgRestore/Settings.pm @@ -153,6 +153,21 @@ method new_no_defaults($class: $deps = {}) { return $self; } +method get_config() { + return { + borg => { + repo => $borg_repo, + path_prefixes => [@backup_prefixes], + }, + cache => { + base_path => $cache_path_base, + database_path => "$cache_path_base/v3/archives.db", + prepare_data_in_memory => $prepare_data_in_memory, + sqlite_memory_cache_size => $sqlite_cache_size, + } + }; +} + fun load_config_files() { my @configfiles; @@ -173,23 +188,10 @@ fun load_config_files() { } } -fun get_cache_base_dir_path($path) { +method get_cache_base_dir_path($path) { return "$cache_path_base/$path"; } -fun get_cache_dir() { - return "$cache_path_base/v3"; -} - -fun get_cache_path($item) { - return get_cache_dir()."/$item"; -} - -fun get_db_path() { - return get_cache_path('archives.db'); -} - - 1; __END__ -- cgit v1.2.3-24-g4f1b