Skip to content

Commit

Permalink
Replace Rack::File with Rack::Files
Browse files Browse the repository at this point in the history
`Rack::File` was deprecated in version 3 of Rack. It was then removed in
version 3.1.

We never used Rack 3.0 in this app, so missed the deprecation warning.

It was only ever aliasing `Rack::Files`, so swapping one for the other.
  • Loading branch information
brucebolt committed Nov 21, 2024
1 parent c2f1d48 commit a845672
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can use the [GOV.UK Docker environment](https://github.com/alphagov/govuk-do

All assets are uploaded to the S3 bucket via a separate `govuk_sidekiq` job triggered if virus scanning succeeds. Assets are currently still also saved to the NFS mount as per the original behaviour.

In non-production environments if the `AWS_S3_BUCKET_NAME` environment variable is not set, then a fake version of S3 (`S3Storage::Fake`) is used and the other `AWS_*` environment variables do not need to be set. In this case, files are saved to the local filesystem instead of S3 and are served via an instance of `Rack::File` mounted on the appropriate route path prefix.
In non-production environments if the `AWS_S3_BUCKET_NAME` environment variable is not set, then a fake version of S3 (`S3Storage::Fake`) is used and the other `AWS_*` environment variables do not need to be set. In this case, files are saved to the local filesystem instead of S3 and are served via an instance of `Rack::Files` mounted on the appropriate route path prefix.

### Manuals and decisions

Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
get "/government/uploads/*path" => "whitehall_media#download"

if AssetManager.s3.fake?
mount Rack::File.new(AssetManager.fake_s3.root), at: AssetManager.fake_s3.path_prefix, as: "fake_s3"
mount Rack::Files.new(AssetManager.fake_s3.root), at: AssetManager.fake_s3.path_prefix, as: "fake_s3"
end

require "sidekiq_unique_jobs/web"
Expand Down

0 comments on commit a845672

Please sign in to comment.