Skip to content

Commit

Permalink
Merge pull request #365 from wlfaltera/customS3host
Browse files Browse the repository at this point in the history
Looks great
  • Loading branch information
ishimoto committed Jan 22, 2013
2 parents 6586cf0 + 0da6a4e commit 7c57b65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,24 @@ public String acl() {
}

public QueryStringAuthGenerator queryStringAuthGenerator() {
return new QueryStringAuthGenerator(accessKeyID(), secretAccessKey(), false);
String host = ERXProperties.stringForKey("er.attachment." + configurationName() + ".s3.host");
if (host == null) {
host = ERXProperties.stringForKey("er.attachment.s3.host");
}
if (host == null)
return new QueryStringAuthGenerator(accessKeyID(), secretAccessKey(), false);
else
return new QueryStringAuthGenerator(accessKeyID(), secretAccessKey(), false, host);
}

public AWSAuthConnection awsConnection() {
AWSAuthConnection conn = new AWSAuthConnection(accessKeyID(), secretAccessKey(), true);
return conn;
String host = ERXProperties.stringForKey("er.attachment." + configurationName() + ".s3.host");
if (host == null) {
host = ERXProperties.stringForKey("er.attachment.s3.host");
}
if (host == null)
return new AWSAuthConnection(accessKeyID(), secretAccessKey(), true);
else
return new AWSAuthConnection(accessKeyID(), secretAccessKey(), true, host);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ <h2>S3 Attachments</h2>

<dt>er.attachment.s3.bucket / er.attachment.[configurationName].s3.bucket</dt>
<dd>(required) The name of the bucket to store and retrieve attachments into. The bucket must already exist in your S3 account.</dd>

<dt>er.attachment.s3.host / er.attachment.[configurationName].s3.host</dt>
<dd>(optional) Defaults to s3.amazonaws.com. Use this property if your bucket is not in the default region. For example put s3-eu-west-1.amazonaws.com for EU(Ireland).</dd>

<dt>er.attachment.s3.key / er.attachment.[configurationName].s3.key</dt>
<dd>(optional) The name of the file to store in the S3 bucket. This is evaluated as a path template. The default value is "${pk}${ext}".</dd>
Expand Down

0 comments on commit 7c57b65

Please sign in to comment.