Merge pull request #847 from yustoris/feature/add-aws-remote-url

RFP: Add endpoint url config for AWS
This commit is contained in:
Ruslan Kuprieiev
2018-07-02 16:15:30 +03:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
+3
View File
@@ -76,6 +76,7 @@ class Config(object):
SECTION_AWS = 'aws'
SECTION_AWS_STORAGEPATH = 'storagepath'
SECTION_AWS_CREDENTIALPATH = 'credentialpath'
SECTION_AWS_ENDPOINT_URL = 'endpointurl'
SECTION_AWS_REGION = 'region'
SECTION_AWS_PROFILE = 'profile'
SECTION_AWS_SCHEMA = {
@@ -83,6 +84,7 @@ class Config(object):
schema.Optional(SECTION_AWS_REGION): str,
schema.Optional(SECTION_AWS_PROFILE, default='default'): str,
schema.Optional(SECTION_AWS_CREDENTIALPATH, default = ''): str,
schema.Optional(SECTION_AWS_ENDPOINT_URL, default=None): str,
}
# backward compatibility
@@ -111,6 +113,7 @@ class Config(object):
schema.Optional(SECTION_AWS_REGION): str,
schema.Optional(SECTION_AWS_PROFILE, default='default'): str,
schema.Optional(SECTION_AWS_CREDENTIALPATH, default = ''): str,
schema.Optional(SECTION_AWS_ENDPOINT_URL, default=None): str,
schema.Optional(SECTION_GCP_PROJECTNAME): str,
schema.Optional(SECTION_CACHE_TYPE): SECTION_CACHE_TYPE_SCHEMA,
schema.Optional(SECTION_REMOTE_USER): str,
+2 -1
View File
@@ -45,6 +45,7 @@ class RemoteS3(RemoteBase):
self.region = config.get(Config.SECTION_AWS_REGION, None)
self.profile = config.get(Config.SECTION_AWS_PROFILE, None)
self.credentialpath = config.get(Config.SECTION_AWS_CREDENTIALPATH, None)
self.endpoint_url = config.get(Config.SECTION_AWS_ENDPOINT_URL, None)
@property
def bucket(self):
@@ -56,7 +57,7 @@ class RemoteS3(RemoteBase):
@property
def s3(self):
return boto3.resource('s3')
return boto3.resource('s3', endpoint_url=self.endpoint_url)
def get_etag(self, bucket, key):
try: