Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non AWS S3 endpoints #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bigstore/backends/s3.py
Original file line number Diff line number Diff line change
@@ -20,10 +20,10 @@
pass

class S3Backend(object):
def __init__(self, bucket_name, key=None, secret=None, profile_name=None):
def __init__(self, bucket_name, key=None, secret=None, profile_name=None, endpoint_url=None):
self.bucket = bucket_name
self.session = boto3.Session(aws_access_key_id=key, aws_secret_access_key=secret, profile_name=profile_name)
self.s3_client = self.session.client('s3')
self.s3_client = self.session.client('s3', endpoint_url=endpoint_url)

@property
def name(self):
6 changes: 5 additions & 1 deletion bigstore/bigstore.py
Original file line number Diff line number Diff line change
@@ -106,7 +106,8 @@ def backend_for_name(name):
access_key_id = config('bigstore.s3.key')
secret_access_key = config('bigstore.s3.secret')
profile_name = config('bigstore.s3.profile-name')
return S3Backend(bucket_name, access_key_id, secret_access_key, profile_name)
endpoint_url = config('bigstore.s3.endpoint-url')
return S3Backend(bucket_name, access_key_id, secret_access_key, profile_name, endpoint_url)
elif name == 'cloudfiles':
username = config('bigstore.cloudfiles.username')
api_key = config('bigstore.cloudfiles.key')
@@ -467,6 +468,7 @@ def request_s3_credentials():
s3_key = input("Access Key: ")
s3_secret = input("Secret Key: ")
s3_profile_name = input("Profile Name: ")
s3_endpoint_url = input("Endpoint URL: ")

g().config("bigstore.backend", "s3", file=config_filename)
g().config("bigstore.s3.bucket", s3_bucket, file=config_filename)
@@ -476,6 +478,8 @@ def request_s3_credentials():
g().config("bigstore.s3.secret", s3_secret, file=config_filename)
if s3_profile_name != '':
g().config("bigstore.s3.profile-name", s3_profile_name, file=config_filename)
if s3_endpoint_url != '':
g().config("bigstore.s3.endpoint-url", s3_endpoint_url, file=config_filename)


def request_google_cloud_storage_credentials():