Commit 6b4d5cf7 by Menno van der Sman Committed by Jon Yurek

Make configuration of :s3_credentials optional

Since AWS-SDK 1.5.3 [1] the library automatically checks for credentials.
This makes it unnecessary to supply credentials when they are present
in environment variables or supplied via an IAM Instance Profile.

[1] http://aws.amazon.com/releasenotes/Ruby/0304005114813505
parent 36b48d05
...@@ -366,8 +366,10 @@ module Paperclip ...@@ -366,8 +366,10 @@ module Paperclip
YAML::load(ERB.new(File.read(creds)).result) YAML::load(ERB.new(File.read(creds)).result)
when Hash when Hash
creds creds
when NilClass
{}
else else
raise ArgumentError, "Credentials are not a path, file, proc, or hash." raise ArgumentError, "Credentials given are not a path, file, proc, or hash."
end end
end end
......
...@@ -737,6 +737,17 @@ class S3Test < Test::Unit::TestCase ...@@ -737,6 +737,17 @@ class S3Test < Test::Unit::TestCase
end end
end end
context "An attachment with S3 storage and S3 credentials not supplied" do
setup do
rebuild_model :storage => :s3, :bucket => "testing"
@dummy = Dummy.new
end
should "not parse any credentials" do
assert_equal({}, @dummy.avatar.s3_credentials)
end
end
context "An attachment with S3 storage and specific s3 headers set" do context "An attachment with S3 storage and specific s3 headers set" do
setup do setup do
rebuild_model :storage => :s3, rebuild_model :storage => :s3,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment