summaryrefslogtreecommitdiff
path: root/app/helpers/webpack_helper.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-15 06:17:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-15 06:17:51 +0000
commit66fc7ba6f3a4a8e74529192f1dd110d87a91fdfb (patch)
tree40057ad8921ec5cac43db5721c1005d186a0fd07 /app/helpers/webpack_helper.rb
parent4f6d64e5bde7e55b2b8f8a6afbdcd911486883b1 (diff)
downloadgitlab-ce-66fc7ba6f3a4a8e74529192f1dd110d87a91fdfb.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/webpack_helper.rb')
-rw-r--r--app/helpers/webpack_helper.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/helpers/webpack_helper.rb b/app/helpers/webpack_helper.rb
index ba3c232bec4..64900714327 100644
--- a/app/helpers/webpack_helper.rb
+++ b/app/helpers/webpack_helper.rb
@@ -83,8 +83,16 @@ module WebpackHelper
end
def webpack_public_host
- # We proxy webpack output in 'test' and 'dev' environment, so we can just use asset_host
- ActionController::Base.asset_host.try(:chomp, '/')
+ # We do not proxy the webpack output in the 'test' environment,
+ # so we must reference the webpack dev server directly.
+ if Rails.env.test? && Gitlab.config.webpack.dev_server.enabled
+ host = Gitlab.config.webpack.dev_server.host
+ port = Gitlab.config.webpack.dev_server.port
+ protocol = Gitlab.config.webpack.dev_server.https ? 'https' : 'http'
+ "#{protocol}://#{host}:#{port}"
+ else
+ ActionController::Base.asset_host.try(:chomp, '/')
+ end
end
def webpack_public_path