Files
openfoodnetwork/app/models/application_record.rb
Matt-Yorkley e54cff2274 Set images to public-read
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.
2023-06-14 10:56:10 +01:00

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