Skip to content

Commit

Permalink
Fix with no paperclip patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AO3 Unicorn service account committed Mar 2, 2024
1 parent 9858bcf commit cec0054
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
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'] ,

Check warning on line 114 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. Raw Output: config/environments/production.rb:114:77: C: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check warning on line 114 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Space found before comma. Raw Output: config/environments/production.rb:114:89: C: Layout/SpaceBeforeComma: Space found before comma.
bucket: ENV['S3_BUCKET'] ,

Check warning on line 115 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. Raw Output: config/environments/production.rb:115:74: C: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check warning on line 115 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Space found before comma. Raw Output: config/environments/production.rb:115:86: C: Layout/SpaceBeforeComma: Space found before comma.
access_key_id: ENV['S3_ACCESS_KEY_ID'] ,

Check warning on line 116 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Align the keys of a hash literal if they span more than one line. Raw Output: config/environments/production.rb:116:62: C: Layout/HashAlignment: Align the keys of a hash literal if they span more than one line.

Check warning on line 116 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. Raw Output: config/environments/production.rb:116:82: C: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check warning on line 116 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Space found before comma. Raw Output: config/environments/production.rb:116:101: C: Layout/SpaceBeforeComma: Space found before comma.
secret_access_key: ENV['S3_SECRET_ACCESS_KEY'] }

Check warning on line 117 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Align the keys of a hash literal if they span more than one line. Raw Output: config/environments/production.rb:117:62: C: Layout/HashAlignment: Align the keys of a hash literal if they span more than one line.

Check warning on line 117 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. Raw Output: config/environments/production.rb:117:86: C: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check warning on line 117 in config/environments/production.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Unnecessary spacing detected. Raw Output: config/environments/production.rb:117:109: C: Layout/ExtraSpacing: Unnecessary spacing detected.

# 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

0 comments on commit cec0054

Please sign in to comment.