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
YAML::load(ERB.new(File.read(creds)).result)
when Hash
creds
when NilClass
{}
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
......
......@@ -737,6 +737,17 @@ class S3Test < Test::Unit::TestCase
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
setup do
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