Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backup/helper.rb')
-rw-r--r--lib/backup/helper.rb29
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/backup/helper.rb b/lib/backup/helper.rb
index 2c2e35add0e..3af786654be 100644
--- a/lib/backup/helper.rb
+++ b/lib/backup/helper.rb
@@ -2,6 +2,8 @@
module Backup
module Helper
+ include ::Gitlab::Utils::StrongMemoize
+
def access_denied_error(path)
message = <<~EOS
@@ -30,12 +32,27 @@ module Backup
raise message
end
- def gzip_cmd
- @gzip_cmd ||= if ENV['GZIP_RSYNCABLE'] == 'yes'
- "gzip --rsyncable -c -1"
- else
- "gzip -c -1"
- end
+ def compress_cmd
+ if ENV['COMPRESS_CMD'].present?
+ puts "Using custom COMPRESS_CMD '#{ENV['COMPRESS_CMD']}'"
+ puts "Ignoring GZIP_RSYNCABLE" if ENV['GZIP_RSYNCABLE'] == 'yes'
+ ENV['COMPRESS_CMD']
+ elsif ENV['GZIP_RSYNCABLE'] == 'yes'
+ "gzip --rsyncable -c -1"
+ else
+ "gzip -c -1"
+ end
+ end
+ strong_memoize_attr :compress_cmd
+
+ def decompress_cmd
+ if ENV['DECOMPRESS_CMD'].present?
+ puts "Using custom DECOMPRESS_CMD '#{ENV['DECOMPRESS_CMD']}'"
+ ENV['DECOMPRESS_CMD']
+ else
+ "gzip -cd"
+ end
end
+ strong_memoize_attr :decompress_cmd
end
end