No commit activity in last 3 years
No release in over 3 years
This gem allows to serve ActiveStorage uploads directly without signature.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0

Runtime

 Project Readme

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.