DEV: ENV variable for brotli quality in assets:precompile rake task (#26286)

Why this change?

This ENV allows the brotli compression quality to be configurable such
that one can opt for a higher/lower level of compression based on their
preferences.
This commit is contained in:
Alan Guo Xiang Tan 2024-03-21 19:07:35 +08:00 committed by GitHub
parent 2d867aa8e5
commit 0aa92500aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -196,7 +196,8 @@ end
# different brotli versions use different parameters
def brotli_command(path, max_compress)
compression_quality = max_compress ? "11" : "6"
compression_quality =
max_compress ? "11" : (ENV["DISCOURSE_ASSETS_PRECOMPILE_DEFAULT_BROTLI_QUALITY"] || "6")
"brotli -f --quality=#{compression_quality} #{path} --output=#{path}.br"
end