/activestorage_direct_disk

This gem allows to serve ActiveStorage uploads directly without signature

Primary LanguageRubyMIT LicenseMIT

ActiveStorage::Service::DirectDiskService

There was a lot of talks if it's good or bad to have permanent static links for your uploads. This gem gives you and option of good old nginx/apache/other-public-server files serving.

Add this to your Gemfile:

gem 'activestorage_direct_disk'

And this to your config/storage.yml:

test:
  service: DirectDisk
  root: 'storage_test'

local:
  service: DirectDisk
  root: 'storage'

And you are done!

As you can see, it stores all the files in the subfolder of your app's public folder, that you specify with root configuration key. All URLs generated by the application will point right to the static file, that can be served directly by nginx. Other behavior is the same as the original Disk Service.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sandrew/activestorage_direct_disk.

License

The gem is available as open source under the terms of the MIT License.