diff --git a/Dockerfile b/Dockerfile index c9dffe506..3d43581d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ RUN apt-get install -y build-essential nodejs && apt-get clean RUN gem install foreman ENV GOVUK_APP_NAME government-frontend -ENV GOVUK_ASSET_ROOT http://assets-origin.dev.gov.uk ENV PORT 3090 ENV RAILS_ENV development diff --git a/config/application.rb b/config/application.rb index 08893bffc..46493f12b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -101,7 +101,11 @@ class Application < Rails::Application config.action_dispatch.rack_cache = nil # Path within public/ where assets are compiled to - config.assets.prefix = "/government-frontend" + config.assets.prefix = "/assets/government-frontend" + + # allow overriding the asset host with an enironment variable, useful for + # when router is proxying to this app but asset proxying isn't set up. + config.asset_host = ENV["ASSET_HOST"] # Do not swallow errors in after_commit/after_rollback callbacks. # config.active_record.raise_in_transactional_callbacks = true diff --git a/config/environments/development.rb b/config/environments/development.rb index a953f8b63..919467e1a 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -51,8 +51,4 @@ # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. # config.file_watcher = ActiveSupport::EventedFileUpdateChecker - - if ENV["GOVUK_ASSET_ROOT"].present? - config.asset_host = ENV["GOVUK_ASSET_ROOT"] - end end diff --git a/config/environments/production.rb b/config/environments/production.rb index 430105d66..efe3d385f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,10 +1,4 @@ Rails.application.configure do - # Set GOVUK_ASSET_ROOT for heroku - for review apps we have the hostname set - # at the time of the app being built so can't be set up in the app.json - if !ENV.include?("GOVUK_ASSET_ROOT") && ENV["HEROKU_APP_NAME"] - ENV["GOVUK_ASSET_ROOT"] = "https://#{ENV['HEROKU_APP_NAME']}.herokuapp.com" - end - # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. @@ -33,10 +27,6 @@ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - config.action_controller.asset_host = Plek.current.asset_root - config.slimmer.asset_host = Plek.current.find("static") - # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX