mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-25 01:23:23 +00:00
Defining an alternate s3 configuration set to `public: true` means we can use it selectively. It sets the objects to `acl: "public-read"` by default (read-only) and means any image tags for those assets can use direct public links in the src attribute (without hitting the ActiveStorage::Representation endpoint). The default non-public service will still be used by default for any other files on instances using s3.
18 lines
425 B
Ruby
18 lines
425 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ApplicationRecord < ActiveRecord::Base
|
|
include DelegateBelongsTo
|
|
include Spree::Core::Permalinks
|
|
include Spree::Preferences::Preferable
|
|
include Searchable
|
|
include ArelHelpers::ArelTable
|
|
include ArelHelpers::Aliases
|
|
include ArelHelpers::JoinAssociation
|
|
|
|
self.abstract_class = true
|
|
|
|
def self.image_service
|
|
ENV["S3_BUCKET"].present? ? :amazon_public : :local
|
|
end
|
|
end
|