move shrine files out of public. use x-sendfile to send files for security.
This commit is contained in:
parent
8e66fb28db
commit
b601b2bbb6
11 changed files with 164 additions and 140 deletions
|
|
@ -1,13 +1,15 @@
|
|||
# See also: https://github.com/erikdahlstrand/shrine-rails-example/blob/master/config/initializers/shrine.rb
|
||||
|
||||
require "shrine"
|
||||
require "shrine/storage/file_system"
|
||||
require 'shrine'
|
||||
require 'shrine/storage/file_system'
|
||||
|
||||
# both `cache` and `store` storages are needed
|
||||
Shrine.storages = {
|
||||
# Saves to ./public/screenshot/ID/image/…
|
||||
cache: Shrine::Storage::FileSystem.new("public", prefix: "cache"),
|
||||
store: Shrine::Storage::FileSystem.new("public", prefix: "shrine"),
|
||||
# Saves to ./shrine/files/screenshot/ID/image/…
|
||||
cache: Shrine::Storage::FileSystem.new(Rails.application.config.shrine_storage_path,
|
||||
prefix: 'cache'),
|
||||
store: Shrine::Storage::FileSystem.new(Rails.application.config.shrine_storage_path,
|
||||
prefix: 'files')
|
||||
}
|
||||
|
||||
# See plugin documentation at https://shrinerb.com/docs/plugins/activerecord
|
||||
|
|
@ -18,6 +20,6 @@ Shrine.plugin :instrumentation
|
|||
Shrine.plugin :determine_mime_type, analyzer: :marcel, log_subscriber: nil
|
||||
Shrine.plugin :cached_attachment_data
|
||||
Shrine.plugin :restore_cached_data
|
||||
Shrine.plugin :derivatives # up front processing
|
||||
Shrine.plugin :derivatives # up front processing
|
||||
# Shrine.plugin :derivation_endpoint, # on-the-fly processing
|
||||
# secret_key: Rails.application.secret_key_base
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue