mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
chore: Add env for handling uploads SSL Termination (#6722)
This commit is contained in:
@@ -38,3 +38,6 @@ USE_MINIO=1
|
|||||||
|
|
||||||
# Nginx Configuration
|
# Nginx Configuration
|
||||||
NGINX_PORT=80
|
NGINX_PORT=80
|
||||||
|
|
||||||
|
# Force HTTPS for handling SSL Termination
|
||||||
|
MINIO_ENDPOINT_SSL=0
|
||||||
|
|||||||
@@ -59,4 +59,7 @@ APP_BASE_URL=
|
|||||||
|
|
||||||
|
|
||||||
# Hard delete files after days
|
# Hard delete files after days
|
||||||
HARD_DELETE_AFTER_DAYS=60
|
HARD_DELETE_AFTER_DAYS=60
|
||||||
|
|
||||||
|
# Force HTTPS for handling SSL Termination
|
||||||
|
MINIO_ENDPOINT_SSL=0
|
||||||
@@ -32,6 +32,12 @@ class S3Storage(S3Boto3Storage):
|
|||||||
) or os.environ.get("MINIO_ENDPOINT_URL")
|
) or os.environ.get("MINIO_ENDPOINT_URL")
|
||||||
|
|
||||||
if os.environ.get("USE_MINIO") == "1":
|
if os.environ.get("USE_MINIO") == "1":
|
||||||
|
|
||||||
|
# Determine protocol based on environment variable
|
||||||
|
if os.environ.get("MINIO_ENDPOINT_SSL") == "1":
|
||||||
|
endpoint_protocol = "https"
|
||||||
|
else:
|
||||||
|
endpoint_protocol = request.scheme if request else "http"
|
||||||
# Create an S3 client for MinIO
|
# Create an S3 client for MinIO
|
||||||
self.s3_client = boto3.client(
|
self.s3_client = boto3.client(
|
||||||
"s3",
|
"s3",
|
||||||
@@ -39,7 +45,7 @@ class S3Storage(S3Boto3Storage):
|
|||||||
aws_secret_access_key=self.aws_secret_access_key,
|
aws_secret_access_key=self.aws_secret_access_key,
|
||||||
region_name=self.aws_region,
|
region_name=self.aws_region,
|
||||||
endpoint_url=(
|
endpoint_url=(
|
||||||
f"{request.scheme}://{request.get_host()}"
|
f"{endpoint_protocol}://{request.get_host()}"
|
||||||
if request
|
if request
|
||||||
else self.aws_s3_endpoint_url
|
else self.aws_s3_endpoint_url
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user