Skip to content

Commit

Permalink
Use Plek#asset_root over Plek#public_asset_host
Browse files Browse the repository at this point in the history
I'm removing this as part of a plan to remove Plek#public_asset_host and
the associated GOVUK_ASSET_HOST env var. The reason to remove these is
because they are the same #asset_root and GOVUK_ASSET_ROOT, which pushes
developers to consider which one to use when they both have the same
effect.

Government frontend appears to be the only app other than Whitehall that
has used this method, which I assume is because the code it is used in
was ported from Whitehall.
  • Loading branch information
kevindew committed Jun 22, 2020
1 parent 38d12b6 commit 38e7231
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/asset_manager_redirect_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AssetManagerRedirectController < ApplicationController
def show
asset_url = Plek.new.public_asset_host
asset_url = Plek.new.asset_root
if request.host.start_with?("draft-")
asset_url = Plek.new.external_url_for("draft-assets")
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/asset_manager_redirect_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class AssetManagerRedirectControllerTest < ActionController::TestCase
setup do
Plek.any_instance.stubs(:public_asset_host).returns("http://asset-host.com")
Plek.any_instance.stubs(:asset_root).returns("http://asset-host.com")
Plek.any_instance.stubs(:external_url_for).returns("http://draft-asset-host.com")
end

Expand Down

0 comments on commit 38e7231

Please sign in to comment.