Merge pull request #889 from mjibson/s3-sigv4-host

Allow setting of boto's S3 host for SIGv4
This commit is contained in:
Matt Jibson 2015-11-18 17:36:15 -05:00
commit 26f1d77a69
2 changed files with 5 additions and 2 deletions

View file

@ -69,7 +69,8 @@ angular.module("core-config-setup", ['angularFileUpload'])
{'name': 's3_access_key', 'title': 'AWS Access Key', 'placeholder': 'accesskeyhere', 'kind': 'text'},
{'name': 's3_secret_key', 'title': 'AWS Secret Key', 'placeholder': 'secretkeyhere', 'kind': 'text'},
{'name': 's3_bucket', 'title': 'S3 Bucket', 'placeholder': 'my-cool-bucket', 'kind': 'text'},
{'name': 'storage_path', 'title': 'Storage Directory', 'placeholder': '/path/inside/bucket', 'kind': 'text'}
{'name': 'storage_path', 'title': 'Storage Directory', 'placeholder': '/path/inside/bucket', 'kind': 'text'},
{'name': 'host', 'title': 'S3 Host (optional)', 'placeholder': 's3.amazonaws.com', 'kind': 'text', 'optional': true}
],
'GoogleCloudStorage': [

View file

@ -396,11 +396,13 @@ class _CloudStorage(BaseStorageV2):
class S3Storage(_CloudStorage):
def __init__(self, storage_path, s3_access_key, s3_secret_key, s3_bucket):
def __init__(self, storage_path, s3_access_key, s3_secret_key, s3_bucket, host=None):
upload_params = {
'encrypt_key': True,
}
connect_kwargs = {}
if host:
connect_kwargs['host'] = host
super(S3Storage, self).__init__(boto.s3.connection.S3Connection, boto.s3.key.Key,
connect_kwargs, upload_params, storage_path, s3_access_key,
s3_secret_key, s3_bucket)