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

Commit

Permalink
fix: config active_storage for the app
Browse files Browse the repository at this point in the history
  • Loading branch information
leio10 committed Jun 30, 2021
1 parent 6c2ed77 commit 8518667
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 38 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ group :development do
end

group :production do
gem "aws-sdk-s3", require: false
gem "fog-aws"
gem "lograge"
gem "sendgrid-ruby"
Expand Down
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,22 @@ GEM
ast (2.4.2)
autoprefixer-rails (8.6.5)
execjs
aws-eventstream (1.1.1)
aws-partitions (1.472.0)
aws-sdk-core (3.115.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.44.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.96.1)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.3)
aws-eventstream (~> 1, >= 1.0.2)
axe-core-api (4.2.1)
capybara
dumb_delegator
Expand Down Expand Up @@ -478,6 +494,7 @@ GEM
invisible_captcha (0.13.0)
rails (>= 3.2.0)
ipaddress (0.8.3)
jmespath (1.4.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
Expand Down Expand Up @@ -847,6 +864,7 @@ PLATFORMS
ruby

DEPENDENCIES
aws-sdk-s3
byebug
decidim!
decidim-dev!
Expand Down
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@
# 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
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@
referer: event.payload[:referer],
}
end

# Store files on Amazon S3.
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 files locally.
config.active_storage.service = :test
end
33 changes: 0 additions & 33 deletions config/initializers/carrierwave.rb

This file was deleted.

5 changes: 0 additions & 5 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

default: &default
sentry_enabled: false
aws_access_key_id: <%= ENV["AWS_ACCESS_KEY_ID"] %>
aws_secret_access_key: <%= ENV["AWS_SECRET_ACCESS_KEY"] %>
aws_region: <%= ENV["AWS_REGION"] %>
aws_bucket: <%= ENV["AWS_BUCKET_NAME"] %>
aws_host: <%= ENV["AWS_HOST"] %>
omniauth:
facebook:
# It must be a boolean. Remember ENV variables doesn't support booleans.
Expand Down
14 changes: 14 additions & 0 deletions config/storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local:
service: Disk
root: <%= Rails.root.join("storage") %>

test:
service: Disk
root: <%= Rails.root.join("tmp/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 8518667

Please sign in to comment.