Skip to content

Commit 8c8af1f

Browse files
committed
use bucket from environment variable
1 parent c8ef49f commit 8c8af1f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

apps/web/src/env.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const env = createEnv({
1313
.url()
1414
.refine(
1515
(str) => !str.includes("YOUR_MYSQL_URL_HERE"),
16-
"You forgot to change the default URL",
16+
"You forgot to change the default URL"
1717
),
1818
NODE_ENV: z
1919
.enum(["development", "test", "production"])
@@ -27,7 +27,7 @@ export const env = createEnv({
2727
// Since NextAuth.js automatically uses the VERCEL_URL if present.
2828
(str) => process.env.VERCEL_URL ?? str,
2929
// VERCEL_URL doesn't include `https` so it cant be validated as a URL
30-
process.env.VERCEL ? z.string() : z.string().url(),
30+
process.env.VERCEL ? z.string() : z.string().url()
3131
),
3232
GITHUB_ID: z.string().optional(),
3333
GITHUB_SECRET: z.string().optional(),
@@ -56,6 +56,7 @@ export const env = createEnv({
5656
S3_COMPATIBLE_SECRET_KEY: z.string().optional(),
5757
S3_COMPATIBLE_API_URL: z.string().optional(),
5858
S3_COMPATIBLE_PUBLIC_URL: z.string().optional(),
59+
S3_COMPATIBLE_BUCKET: z.string().optional(),
5960
STRIPE_SECRET_KEY: z.string().optional(),
6061
STRIPE_BASIC_PRICE_ID: z.string().optional(),
6162
STRIPE_BASIC_USAGE_PRICE_ID: z.string().optional(),
@@ -109,6 +110,7 @@ export const env = createEnv({
109110
S3_COMPATIBLE_SECRET_KEY: process.env.S3_COMPATIBLE_SECRET_KEY,
110111
S3_COMPATIBLE_API_URL: process.env.S3_COMPATIBLE_API_URL,
111112
S3_COMPATIBLE_PUBLIC_URL: process.env.S3_COMPATIBLE_PUBLIC_URL,
113+
S3_COMPATIBLE_BUCKET: process.env.S3_COMPATIBLE_BUCKET,
112114
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
113115
STRIPE_BASIC_PRICE_ID: process.env.STRIPE_BASIC_PRICE_ID,
114116
STRIPE_BASIC_USAGE_PRICE_ID: process.env.STRIPE_BASIC_USAGE_PRICE_ID,

apps/web/src/server/service/storage-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
33
import { env } from "~/env";
44

55
let S3: S3Client | null = null;
6-
export const DEFAULT_BUCKET = "unsend";
6+
export const DEFAULT_BUCKET = env.S3_COMPATIBLE_BUCKET || "unsend";
77

88
export const isStorageConfigured = () =>
99
!!(

0 commit comments

Comments
 (0)