diff --git a/config/secrets.yml.example b/config/secrets.yml.example index dcc96594..abbc75b9 100644 --- a/config/secrets.yml.example +++ b/config/secrets.yml.example @@ -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 @@ -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 @@ -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: ??????????? diff --git a/lib/image_cacher.rb b/lib/image_cacher.rb index a9b9f313..5a1a855a 100644 --- a/lib/image_cacher.rb +++ b/lib/image_cacher.rb @@ -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 @@ -79,4 +79,4 @@ def store_product_image(product, col, mime, data) key end -end \ No newline at end of file +end diff --git a/lib/v1/exporter.rb b/lib/v1/exporter.rb index 797f564a..e1f0bb90 100644 --- a/lib/v1/exporter.rb +++ b/lib/v1/exporter.rb @@ -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