Update payload.config.ts to assert non-null environment variables

Use non-null assertion operator for R2 environment variables to ensure
they are defined at runtime.
This commit is contained in:
2025-10-13 14:03:21 +08:00
parent a9041e9c22
commit 5581ae7023

View File

@@ -72,12 +72,12 @@ export default buildConfig({
collections: {
media: true,
},
bucket: process.env.R2_BUCKET,
bucket: process.env.R2_BUCKET!,
config: {
endpoint: `https://${process.env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com`,
endpoint: `https://${process.env.R2_ACCOUNT_ID!}.r2.cloudflarestorage.com`,
credentials: {
accessKeyId: process.env.R2_ACCESS_KEY_ID,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
},
region: 'auto',
// ... Other S3 configuration