mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Configure Active Storage
We are re-using the same config used for Paperclip except for disk storage. Active Storage uses directory sharding on the local disk which means that we can't create blob entries that point to the existing Paperclip files. We will just copy them to the standard `storage/` directory.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,6 +15,7 @@ db/*.csv
|
||||
log/*.log
|
||||
log/*.log.lck
|
||||
log/*.log.*
|
||||
/storage
|
||||
tmp/
|
||||
.idea/*
|
||||
\#*
|
||||
|
||||
@@ -238,5 +238,7 @@ module Openfoodnetwork
|
||||
Rails.application.routes.default_url_options[:host] = ENV["SITE_URL"]
|
||||
|
||||
Rails.autoloaders.main.ignore(Rails.root.join('app/webpacker'))
|
||||
|
||||
config.active_storage.service = ENV["S3_BUCKET"].present? ? :amazon : :local
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,4 +51,6 @@ Openfoodnetwork::Application.configure do
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
config.active_job.queue_adapter = :test
|
||||
|
||||
config.active_storage.service = :test
|
||||
end
|
||||
|
||||
14
config/storage.yml
Normal file
14
config/storage.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
local:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("storage") %>
|
||||
|
||||
test:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("tmp/storage") %>
|
||||
|
||||
amazon:
|
||||
service: S3
|
||||
access_key_id: <%= ENV["S3_ACCESS_KEY"] %>
|
||||
secret_access_key: <%= ENV["S3_SECRET"] %>
|
||||
bucket: <%= ENV["S3_BUCKET"] %>
|
||||
region: <%= ENV.fetch("S3_REGION", "us-east-1") %>
|
||||
Reference in New Issue
Block a user