-
Notifications
You must be signed in to change notification settings - Fork 986
Description
Hello @stephengpope
Awesome (really awesome) project.
I am running on a VPS (Hostinger + Coolify) and setting up my S3 env variables to use Cloudflare R2 object storage. This request may be relevant to other S3 compatible services.
I have toolkit running well on my VPS, but am running into issues using Cloudflare R2 public buckets.
Currently, I am configured with a standard R2 endpoint and a bucket name:
S3_ENDPOINT_URL="https://7513e39970404e276fb0ab7d1a2d66a5.r2.cloudflarestorage.com"
S3_BUCKET_NAME="ncatoolkit"
All is working as expected with route responses building URLs for generated files in the format of
$S3_ENDPOINT_URL/$S3_BUCKET_NAME/<somefile>
ex when hitting /v1/toolkit/test:
"response": "https://7513e39970404e276fb0ab7d1a2d66a5.r2.cloudflarestorage.com/ncatoolkit/success.txt",
By default, R2 buckets are private and require authentication to access toolkit generated URLs.
I would like to make my bucket public so that I can easily incorporate the response URLs in downstream automations.
R2 requires the use of a custom domain to make a bucket public. When setting up the R2 custom domain, it is assigned to a specific bucket and all public facing URLs are in the form of
https://custom.domain/<somefile>
# Note that the bucket name is omitted.
I would like to be able to configure the S3 environment variables in 1 of 2 ways:
- Omit the bucket name (allow it to be blank):
S3_ENDPOINT_URL="s3.cliq.dev"
S3_BUCKET_NAME=""
and have the responses generate URLs without appending the bucket name so it would generate URLs without the bucket name like:
https://s3.cliq.dev/success.txt
This may create other complications for toolkit since some operations may require a bucket name. Alternatively....
- Add a new
S3_PUBLIC_ENDPOINT_URL
S3_ENDPOINT_URL="https://7513e39970404e276fb0ab7d1a2d66a5.r2.cloudflarestorage.com"
S3_BUCKET_NAME="ncatoolkit"
S3_PUBLIC_ENDPOINT_URL="https://s3.cliq.dev"
and have the responses use the new S3_PUBLIC_ENDPOINT_URL for generated files like:
https://s3.cliq.dev/success.txt
This setup would allow creating read-only access through S3_PUBLIC_ENDPOINT_URL which ultimately is the intended result.
What say you?