Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making S3 region configurable #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/secrets.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ development:
s3_access_key: ????????????????????????
s3_secret_key: ?????????????????????????????????????
s3_bucket: static.mylcbostorage.com
s3_region: us-east-1
lcbo_user_agent: LCBOAPI/2.0
secret_key_base: 52a253526e6b6a81af2d10160396f6d85796351a23aed414a59897811556353e0515c819074387a4e18c5cf38f429ee04b9efb7e926b8313401f2f4bcaf676d6
admin_username: admin
Expand All @@ -17,6 +18,7 @@ test:
s3_access_key: ???????????????????????
s3_secret_key: ??????????????????????????????????
s3_bucket: static.mylcbostorage.com
s3_region: us-east-1
lcbo_user_agent: LCBOAPI/2.0
secret_key_base: 52a253526e6b6a81af2d10160396f6d85796351a23aed414a59897811556353e0515c819074387a4e18c5cf38f429ee04b9efb7e926b8313401f2f4bcaf676d6
admin_username: admin
Expand All @@ -31,6 +33,7 @@ production:
s3_access_key: ????????????????
s3_secret_key: ????????????????????????????????
s3_bucket: static.mylcbostorage.com
s3_region: us-east-1
lcbo_user_agent: LCBOAPI/2.0
secret_key_base: RUN `rake secret` and use output here
admin_username: ???????????
Expand Down
4 changes: 2 additions & 2 deletions lib/image_cacher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.run

def initialize
@s3 = Aws::S3::Client.new(
region: 'us-east-1',
region: Rails.application.secrets.s3_region,
credentials: Aws::Credentials.new(
Rails.application.secrets.s3_access_key,
Rails.application.secrets.s3_secret_key
Expand Down Expand Up @@ -79,4 +79,4 @@ def store_product_image(product, col, mime, data)

key
end
end
end
2 changes: 1 addition & 1 deletion lib/v1/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def initialize(key)
@key = key
@dir = File.join(Dir.tmpdir, 'lcboapi-tmp')
@s3 = Aws::S3::Client.new(
region: 'us-east-1',
region: Rails.application.secrets.s3_region,
credentials: Aws::Credentials.new(
Rails.application.secrets.s3_access_key,
Rails.application.secrets.s3_secret_key
Expand Down