mirror of
https://github.com/discourse/discourse.git
synced 2025-03-04 00:09:39 +08:00
FEATURE: remove "COMPRESS_BROTLI" optional behavior
The compress brotli functionality is no longer optional, this has worked well for years. The name of the ENV var is also confusing cause it does not have a `DISCOURSE_` prefix which caused issues with the web upgrader Brotli support is now unconditionally on
This commit is contained in:
parent
7a7c6af21e
commit
baa7a9836c
@ -54,7 +54,6 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def is_brotli_req?
|
||||
ENV["COMPRESS_BROTLI"] == "1" &&
|
||||
request.env["HTTP_ACCEPT_ENCODING"] =~ /br/
|
||||
end
|
||||
|
||||
|
@ -115,7 +115,6 @@ def gzip(path)
|
||||
raise "gzip compression failed: exit code #{$?.exitstatus}" if $?.exitstatus != 0
|
||||
end
|
||||
|
||||
if ENV['COMPRESS_BROTLI']&.to_i == 1
|
||||
# different brotli versions use different parameters
|
||||
ver_out, _ver_err, ver_status = Open3.capture3('brotli --version')
|
||||
if !ver_status.success?
|
||||
@ -131,17 +130,14 @@ if ENV['COMPRESS_BROTLI']&.to_i == 1
|
||||
# not sure what to do here, not expecting this
|
||||
raise "cannot determine brotli version"
|
||||
end
|
||||
end
|
||||
|
||||
def brotli(path)
|
||||
if ENV['COMPRESS_BROTLI']&.to_i == 1
|
||||
STDERR.puts brotli_command(path)
|
||||
STDERR.puts `#{brotli_command(path)}`
|
||||
raise "brotli compression failed: exit code #{$?.exitstatus}" if $?.exitstatus != 0
|
||||
STDERR.puts `chmod +r #{path}.br`.strip
|
||||
raise "chmod failed: exit code #{$?.exitstatus}" if $?.exitstatus != 0
|
||||
end
|
||||
end
|
||||
|
||||
def compress(from, to)
|
||||
if $node_uglify
|
||||
|
@ -5,7 +5,6 @@ describe ApplicationHelper do
|
||||
describe "preload_script" do
|
||||
it "provides brotli links to brotli cdn" do
|
||||
set_cdn_url "https://awesome.com"
|
||||
set_env "COMPRESS_BROTLI", "1"
|
||||
|
||||
helper.request.env["HTTP_ACCEPT_ENCODING"] = 'br'
|
||||
link = helper.preload_script('application')
|
||||
@ -20,7 +19,6 @@ describe ApplicationHelper do
|
||||
global_setting :s3_access_key_id, '123'
|
||||
global_setting :s3_secret_access_key, '123'
|
||||
global_setting :s3_cdn_url, 'https://s3cdn.com'
|
||||
set_env "COMPRESS_BROTLI", "1"
|
||||
end
|
||||
|
||||
after do
|
||||
|
Loading…
x
Reference in New Issue
Block a user