Merge pull request #1033 from junousi/public_url_https
Configurable public URL protocol
Florent Viard authored 5 years ago
GitHub committed 5 years ago
204 | 204 |
# Maximum sleep duration for throtte / limitrate.
|
205 | 205 |
# s3 will timeout if a request/transfer is stuck for more than a short time
|
206 | 206 |
throttle_max = 100
|
|
207 |
public_url_use_https = False
|
207 | 208 |
|
208 | 209 |
## Creating a singleton
|
209 | 210 |
def __new__(self, configfile = None, access_key=None, secret_key=None, access_token=None):
|
89 | 89 |
return check_bucket_name_dns_support(Config.Config().host_bucket, self._bucket)
|
90 | 90 |
|
91 | 91 |
def public_url(self):
|
|
92 |
public_url_protocol = "http"
|
|
93 |
if Config.Config().public_url_use_https:
|
|
94 |
public_url_protocol = "https"
|
92 | 95 |
if self.is_dns_compatible():
|
93 | |
return "http://%s.%s/%s" % (self._bucket, Config.Config().host_base, self._object)
|
94 | |
else:
|
95 | |
return "http://%s/%s/%s" % (Config.Config().host_base, self._bucket, self._object)
|
|
96 |
return "%s://%s.%s/%s" % (public_url_protocol, self._bucket, Config.Config().host_base, self._object)
|
|
97 |
else:
|
|
98 |
return "%s://%s/%s/%s" % (public_url_protocol, Config.Config().host_base, self._bucket, self._object)
|
96 | 99 |
|
97 | 100 |
def host_name(self):
|
98 | 101 |
if self.is_dns_compatible():
|