mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-10 17:03:56 +08:00
Merge pull request #1400 from okriuchykhin/ok_SCI_2727
Make AWS access key variables optional [SCI-2727]
This commit is contained in:
commit
a4b75f00d2
2 changed files with 4 additions and 11 deletions
|
@ -1,10 +1,5 @@
|
||||||
if ENV['AWS_ACCESS_KEY_ID']
|
# frozen_string_literal: true
|
||||||
Aws.config.update(
|
|
||||||
region: ENV['AWS_REGION'],
|
|
||||||
credentials: Aws::Credentials.new(
|
|
||||||
ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
if ENV['PAPERCLIP_STORAGE'] == 's3'
|
||||||
S3_BUCKET = Aws::S3::Resource.new.bucket(ENV['S3_BUCKET'])
|
S3_BUCKET = Aws::S3::Resource.new.bucket(ENV['S3_BUCKET'])
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,10 +14,8 @@ Paperclip::Attachment.default_options.merge!(
|
||||||
Paperclip::UriAdapter.register
|
Paperclip::UriAdapter.register
|
||||||
|
|
||||||
if ENV['PAPERCLIP_STORAGE'] == 's3'
|
if ENV['PAPERCLIP_STORAGE'] == 's3'
|
||||||
if ENV['S3_BUCKET'].nil? || ENV['AWS_REGION'].nil? ||
|
if ENV['S3_BUCKET'].nil? || ENV['AWS_REGION'].nil?
|
||||||
ENV['AWS_ACCESS_KEY_ID'].nil? || ENV['AWS_SECRET_ACCESS_KEY'].nil?
|
puts 'WARNING! Environment variables S3_BUCKET and AWS_REGION must be set.'
|
||||||
puts 'WARNING! Environment variables S3_BUCKET, AWS_REGION, '\
|
|
||||||
'AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set.'
|
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue