Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Setup ActiveStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolgual committed Jan 29, 2022
1 parent 126d4e6 commit e66c6de
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ group :development do
end

group :production do
gem "fog-aws"
gem "aws-sdk-s3", require: false
gem "lograge"
gem "sendgrid-ruby"
gem "sentry-ruby"
Expand Down
31 changes: 18 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,22 @@ GEM
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.551.0)
aws-sdk-core (3.125.5)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.53.0)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.111.3)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.4.0)
aws-eventstream (~> 1, >= 1.0.2)
axe-core-api (4.3.2)
dumb_delegator
virtus
Expand Down Expand Up @@ -408,24 +424,13 @@ GEM
file_validators (2.3.0)
activemodel (>= 3.2)
mime-types (>= 1.0)
fog-aws (3.10.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-core (2.2.4)
builder
excon (~> 0.71)
formatador (~> 0.2)
mime-types
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-local (0.7.0)
fog-core (>= 1.27, < 3.0)
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
formatador (0.3.0)
foundation_rails_helper (4.0.0)
actionpack (>= 4.1, < 7.0)
Expand Down Expand Up @@ -472,7 +477,7 @@ GEM
ruby-vips (>= 2.0.17, < 3)
invisible_captcha (0.13.0)
rails (>= 3.2.0)
ipaddress (0.8.3)
jmespath (1.5.0)
json (2.6.1)
jwt (2.2.3)
kaminari (1.2.1)
Expand Down Expand Up @@ -837,12 +842,12 @@ PLATFORMS
ruby

DEPENDENCIES
aws-sdk-s3
byebug
decidim!
decidim-dev!
decidim-elections!
faker (~> 2.14)
fog-aws
letter_opener_web (~> 1.4.0)
listen (~> 3.1.0)
lograge
Expand Down
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Store files locally.
config.active_storage.service = :local
end
2 changes: 2 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,6 @@
referer: event.payload[:referer],
}
end

config.active_storage.service = :amazon
end
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
end
Empty file.
33 changes: 0 additions & 33 deletions config/initializers/carrierwave.rb

This file was deleted.

10 changes: 10 additions & 0 deletions config/storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local:
service: Disk
root: <%= Rails.root.join("storage") %>

amazon:
service: S3
access_key_id: <%= ENV["AWS_ACCESS_KEY_ID"] %>
secret_access_key: <%= ENV["AWS_SECRET_ACCESS_KEY"] %>
region: <%= ENV["AWS_REGION"] %>
bucket: <%= ENV["AWS_BUCKET_NAME"] %>

0 comments on commit e66c6de

Please sign in to comment.