Skip to content

Commit d44658b

Browse files
committed
add STACK_S3_PUBLIC_ENDPOINT
1 parent 5c2b738 commit d44658b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/backend/.env‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ STACK_SVIX_SERVER_URL=# For prod, leave it empty. For local development, use `ht
5151
STACK_SVIX_API_KEY=# enter the API key for the Svix webhook service here. Use `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2NTUxNDA2MzksImV4cCI6MTk3MDUwMDYzOSwibmJmIjoxNjU1MTQwNjM5LCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.En8w77ZJWbd0qrMlHHupHUB-4cx17RfzFykseg95SUk` for local development
5252

5353
# S3
54-
STACK_S3_ENDPOINT=# S3 endpoint URL (e.g., 'https://s3.amazonaws.com' for AWS or custom endpoint for S3-compatible services)
54+
STACK_S3_PUBLIC_ENDPOINT=# publicly accessible endpoint
55+
STACK_S3_ENDPOINT=# S3 API endpoint URL (e.g., 'https://s3.amazonaws.com' for AWS or custom endpoint for S3-compatible services)
5556
STACK_S3_REGION=
5657
STACK_S3_ACCESS_KEY_ID=
5758
STACK_S3_SECRET_ACCESS_KEY=

‎apps/backend/src/s3.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ImageProcessingError, parseBase64Image } from "./lib/images";
55

66
const S3_REGION = getEnvVariable("STACK_S3_REGION", "");
77
const S3_ENDPOINT = getEnvVariable("STACK_S3_ENDPOINT", "");
8+
const S3_PUBLIC_ENDPOINT = getEnvVariable("STACK_S3_PUBLIC_ENDPOINT", S3_ENDPOINT);
89
const S3_BUCKET = getEnvVariable("STACK_S3_BUCKET", "");
910
const S3_ACCESS_KEY_ID = getEnvVariable("STACK_S3_ACCESS_KEY_ID", "");
1011
const S3_SECRET_ACCESS_KEY = getEnvVariable("STACK_S3_SECRET_ACCESS_KEY", "");
@@ -26,7 +27,7 @@ const s3Client = HAS_S3 ? new S3Client({
2627
}) : undefined;
2728

2829
export function getS3PublicUrl(key: string): string {
29-
return `${S3_ENDPOINT}/${S3_BUCKET}/${key}`;
30+
return `${S3_PUBLIC_ENDPOINT}/${S3_BUCKET}/${key}`;
3031
}
3132

3233
async function uploadBase64Image({

0 commit comments

Comments
 (0)