paperclip-aws-core 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paperclip/aws/core/version.rb +1 -1
- data/lib/paperclip/aws/core.rb +5 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 718454772184aea711b5a7921937f21355f73e43
|
4
|
+
data.tar.gz: f5737e886600db7abab0d67ee8941ddabca856eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77089decbafe4ecc06106fb2570345098d1d2ff243efba08dda907ff25fbdb025997049c97f77758261f1457eb534bff03a47c4525f44b901f1363caf811018d
|
7
|
+
data.tar.gz: 9097e9ea7bf8104dd66e6b5ef7aede105b4b0e59944ee20d48b4c07bcc47ce60d52fce663ce2f169644ba50522d6c72ed1c7791dceee25d49f8ef06f40b35760
|
data/lib/paperclip/aws/core.rb
CHANGED
@@ -14,6 +14,9 @@ module Paperclip
|
|
14
14
|
|
15
15
|
base.instance_eval do
|
16
16
|
@s3_options = @options[:s3_options] || {}
|
17
|
+
|
18
|
+
@s3_endpoint = @options[:s3_endpoint]
|
19
|
+
|
17
20
|
|
18
21
|
@s3_protocol = @options[:s3_protocol] ||
|
19
22
|
Proc.new do |style, attachment|
|
@@ -92,16 +95,11 @@ module Paperclip
|
|
92
95
|
|
93
96
|
def obtain_s3_instance_for(options)
|
94
97
|
instances = (Thread.current[:paperclip_s3_instances] ||= {})
|
95
|
-
instances[options] ||= ::Aws::S3.new(endpoint: s3_endpoint)
|
98
|
+
instances[options] ||= s3_endpoint.present? ? ::Aws::S3.new(endpoint: s3_endpoint) : ::Aws::S3.new(endpoint: s3_endpoint)
|
96
99
|
end
|
97
100
|
|
98
101
|
def s3_endpoint
|
99
|
-
|
100
|
-
when 'us-east-01'
|
101
|
-
's3.amazonaws.com'
|
102
|
-
else
|
103
|
-
"s3-#{Aws.config[:region]}.amazonaws.com"
|
104
|
-
end
|
102
|
+
@s3_endpoint
|
105
103
|
end
|
106
104
|
|
107
105
|
|