Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-6647 Fix paperclip with no paperclip patch #4761

Merged
merged 2 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/models/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class Collection < ApplicationRecord
path: %w(staging production).include?(Rails.env) ? ":class/:attachment/:id/:style.:extension" : ":rails_root/public:url",
storage: %w(staging production).include?(Rails.env) ? :s3 : :filesystem,
s3_protocol: "https",
s3_credentials: "#{Rails.root}/config/s3.yml",
bucket: %w(staging production).include?(Rails.env) ? YAML.load_file("#{Rails.root}/config/s3.yml")['bucket'] : "",
default_url: "/images/skins/iconsets/default/icon_collection.png"

validates_attachment_content_type :icon, content_type: /image\/\S+/, allow_nil: true
Expand Down
2 changes: 0 additions & 2 deletions app/models/pseud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class Pseud < ApplicationRecord
end,
storage: %w(staging production).include?(Rails.env) ? :s3 : :filesystem,
s3_protocol: "https",
s3_credentials: "#{Rails.root}/config/s3.yml",
bucket: %w(staging production).include?(Rails.env) ? YAML.load_file("#{Rails.root}/config/s3.yml")['bucket'] : "",
default_url: "/images/skins/iconsets/default/icon_user.png"

validates_attachment_content_type :icon,
Expand Down
2 changes: 0 additions & 2 deletions app/models/skin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class Skin < ApplicationRecord
path: %w(staging production).include?(Rails.env) ? ":class/:attachment/:id/:style.:extension" : ":rails_root/public:url",
storage: %w(staging production).include?(Rails.env) ? :s3 : :filesystem,
s3_protocol: "https",
s3_credentials: "#{Rails.root}/config/s3.yml",
bucket: %w(staging production).include?(Rails.env) ? YAML.load_file("#{Rails.root}/config/s3.yml")['bucket'] : "",
default_url: "/images/skins/iconsets/default/icon_skins.png"

after_save :skin_invalidate_cache
Expand Down
7 changes: 7 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

# paperclip config
Paperclip::Attachment.default_options[:storage] = :s3
Paperclip::Attachment.default_options[:s3_credentials] = { s3_region: ENV["S3_REGION"],
bucket: ENV["S3_BUCKET"],
access_key_id: ENV["S3_ACCESS_KEY_ID"],
secret_access_key: ENV["S3_SECRET_ACCESS_KEY"] }

# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
Expand Down
6 changes: 6 additions & 0 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
Bullet.counter_cache_enable = false
end

Paperclip::Attachment.default_options[:storage] = :s3
Paperclip::Attachment.default_options[:s3_credentials] = { s3_region: ENV["S3_REGION"],
bucket: ENV["S3_BUCKET"],
access_key_id: ENV["S3_ACCESS_KEY_ID"],
secret_access_key: ENV["S3_SECRET_ACCESS_KEY"] }

config.middleware.use Rack::Attack

# Disable dumping schemas after migrations.
Expand Down
Loading