forked from github/plane
dev: self hosted private settings
This commit is contained in:
parent
c76d1dc8db
commit
7e6e6531ad
@ -1,8 +1,5 @@
|
||||
"""Self hosted settings and globals."""
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import dj_database_url
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
||||
from .common import * # noqa
|
||||
@ -65,6 +62,8 @@ STORAGES["default"] = {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"}
|
||||
# Common AWS settings
|
||||
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID", "access-key")
|
||||
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY", "secret-key")
|
||||
AWS_REGION_NAME = os.environ.get("AWS_REGION")
|
||||
AWS_S3_ADDRESSING_STYLE = os.environ.get("AWS_S3_ADDRESSING_STYLE")
|
||||
AWS_S3_ENDPOINT_URL = os.environ.get(
|
||||
"AWS_S3_ENDPOINT_URL", "http://plane-minio:9000"
|
||||
)
|
||||
|
@ -12,21 +12,22 @@ class PublicS3Storage(S3Boto3Storage):
|
||||
# For self hosted docker and minio
|
||||
if settings.DOCKERIZED and settings.USE_MINIO:
|
||||
parsed_url = urlparse(settings.WEB_URL)
|
||||
custom_domain = f"{parsed_url.netloc}/{settings.bucket_name}"
|
||||
custom_domain = f"{parsed_url.netloc}/{bucket_name}"
|
||||
url_protocol = f"{parsed_url.scheme}:"
|
||||
|
||||
|
||||
|
||||
class PrivateS3Storage(S3Boto3Storage):
|
||||
"""Configuration for the Private bucket storage"""
|
||||
bucket_name = settings.AWS_PRIVATE_STORAGE_BUCKET_NAME
|
||||
default_acl = settings.AWS_PRIVATE_DEFAULT_ACL
|
||||
file_overwrite = settings.AWS_S3_PRIVATE_FILE_OVERWRITE
|
||||
region_name = settings.AWS_REGION_NAME
|
||||
addressing_style = settings.AWS_S3_ADDRESSING_STYLE
|
||||
default_acl = settings.AWS_PRIVATE_DEFAULT_ACL
|
||||
|
||||
# For self hosted docker and minio
|
||||
if settings.DOCKERIZED and settings.USE_MINIO:
|
||||
parsed_url = urlparse(settings.WEB_URL)
|
||||
custom_domain = f"{parsed_url.netloc}/{settings.bucket_name}"
|
||||
custom_domain = f"{parsed_url.netloc}/{bucket_name}"
|
||||
url_protocol = f"{parsed_url.scheme}:"
|
||||
default_acl = None
|
||||
querystring_auth = True
|
||||
addressing_style = None
|
||||
|
@ -111,11 +111,13 @@ services:
|
||||
createbuckets:
|
||||
image: minio/mc
|
||||
entrypoint: >
|
||||
/bin/sh -c " /usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY;
|
||||
/bin/sh -c "
|
||||
/usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY;
|
||||
/usr/bin/mc mb plane-minio/\$AWS_PUBLIC_STORAGE_BUCKET_NAME;
|
||||
/usr/bin/mc anonymous set download plane-minio/\$AWS_PUBLIC_STORAGE_BUCKET_NAME; exit 0;
|
||||
/usr/bin/mc anonymous set download plane-minio/\$AWS_PUBLIC_STORAGE_BUCKET_NAME;
|
||||
/usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY;
|
||||
/usr/bin/mc mb plane-minio/\$AWS_PRIVATE_STORAGE_BUCKET_NAME;
|
||||
/usr/bin/mc anonymous set none plane-minio/\$AWS_PRIVATE_STORAGE_BUCKET_NAME; exit 0;
|
||||
"
|
||||
env_file:
|
||||
- .env
|
||||
|
Loading…
Reference in New Issue
Block a user