diff --git a/apps/cos/client.py b/apps/cos/client.py index 0c39402..2449d69 100644 --- a/apps/cos/client.py +++ b/apps/cos/client.py @@ -50,6 +50,7 @@ class COSCredential: token: str start_time: int expired_time: int + use_accelerate: bool class COSClient: @@ -107,6 +108,7 @@ async def generate_cos_upload_credential(self, filename: str) -> COSCredential: token=response["credentials"]["sessionToken"], start_time=response["startTime"], expired_time=response["expiredTime"], + use_accelerate=settings.QCLOUD_COS_USE_ACCELERATE, ) except Exception as err: logger.exception("[TempKeyGenerateFailed] %s", err) diff --git a/entry/settings.py b/entry/settings.py index 6aa8702..cbb5747 100644 --- a/entry/settings.py +++ b/entry/settings.py @@ -245,6 +245,7 @@ QCLOUD_COS_RANDOM_KEY_LENGTH = int(os.getenv("QCLOUD_COS_RANDOM_KEY_LENGTH", "10")) QCLOUD_KEY_DUPLICATE_TIMEOUT = int(os.getenv("QCLOUD_KEY_DUPLICATE_TIMEOUT", str(60 * 60 * 24))) QCLOUD_COS_IMAGE_STYLE = os.getenv("QCLOUD_COS_IMAGE_STYLE", "imageMogr2/quality/80/format/webp/interlace/1") +QCLOUD_COS_USE_ACCELERATE = strtobool(os.getenv("QCLOUD_COS_USE_ACCELERATE", "False")) # STS QCLOUD_API_DOMAIN_TMPL = os.getenv("QCLOUD_API_DOMAIN_TMPL", "{}.tencentcloudapi.com")