WIP use s3 without region

This commit is contained in:
Kasia Jarmołkowicz 2018-05-18 14:25:07 +02:00 committed by Eric Schultz
parent 02868b5e17
commit abd5fbe63e
4 changed files with 5 additions and 7 deletions

View file

@ -46,8 +46,6 @@ class ProfilesController < ApplicationController
else
@profile = current_user.profile
end
puts "______________awsbucketaddress: #{Settings.image.host}"
puts "______________awsbucketaddress: #{Settings.image&.host}"
@profile.update_attributes(params[:profile])
json_saved @profile, 'Profile updated'
end

View file

@ -63,7 +63,7 @@ Config.schema do
required(:aws).schema do
# the region your AWS bucket is in
required(:region).filled(:str?)
# required(:region).filled(:str?)
# the name of your aws bucket
required(:bucket).filled(:str?)
@ -295,4 +295,3 @@ Settings.reload!
# Initialize the rails application
Commitchange::Application.initialize!

View file

@ -4,8 +4,7 @@ CarrierWave.configure do |config|
config.storage = :aws
config.aws_bucket = Settings.aws.bucket
config.aws_acl = :public_read
# config.asset_host = Settings.image&.host || "https://s3-#{Settings.aws.region}.amazonaws.com/#{Settings.aws.bucket}"
config.asset_host = "https://s3.amazonaws.com/#{Settings.aws.bucket}"
config.asset_host = Settings.image&.host || "https://s3-#{Settings.aws.region}.amazonaws.com/#{Settings.aws.bucket}"
config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365
config.aws_credentials = {
access_key_id: Settings.aws.access_key_id,

View file

@ -20,9 +20,11 @@ default:
aws:
access_key_id: <%= ENV['AWS_ACCESS_KEY'] %>
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
region: <%= ENV['AWS_REGION'] %>
bucket: <%= ENV['S3_BUCKET_NAME'] %>
image:
host: "https://#{Settings.aws.bucket}.s3.amazonaws.com"
mailer:
delivery_method: "sendmail"
address: "localhost"