Skip to content

Commit

Permalink
Do not force local Paperclip storage in storybook seeds
Browse files Browse the repository at this point in the history
The storybook GitHub action sets the `S3_*` environment variables to
use example files from an S3 bucket. Leave Paperclip config untouched
if these variables have been set.
  • Loading branch information
tf committed Dec 11, 2023
1 parent 8ed1010 commit c149d8d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions spec/support/pageflow/dummy/config/pageflow.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
Pageflow.configure do |config|
config.paperclip_s3_root = 'test-host'
s3_bucket = config.paperclip_s3_default_options.dig(:s3_credentials, :bucket)

config.paperclip_s3_default_options.merge!(
storage: :filesystem,
url: '/system/s3/:class/:attachment/:id_partition/:style/:filename',
path: ':rails_root/public:url'
)
if s3_bucket == 'com-example-pageflow-development'
config.paperclip_s3_root = 'test-host'

config.paperclip_direct_upload_options = lambda do |_|
{
url: '#',
fields: []
}
config.paperclip_s3_default_options.merge!(
storage: :filesystem,
url: '/system/s3/:class/:attachment/:id_partition/:style/:filename',
path: ':rails_root/public:url'
)

config.paperclip_direct_upload_options = lambda do |_|
{
url: '#',
fields: []
}
end
end
end

0 comments on commit c149d8d

Please sign in to comment.