Use hardcoded R2 credentials (for testing only)
This commit is contained in:
parent
73c3ddb53e
commit
7b4f47667b
1 changed files with 8 additions and 7 deletions
|
|
@ -3,14 +3,15 @@ import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
function getR2() {
|
||||
const accountId = process.env.R2_ACCOUNT_ID;
|
||||
const accessKeyId = process.env.R2_ACCESS_KEY_ID;
|
||||
const secretKey = process.env.R2_SECRET_ACCESS_KEY;
|
||||
const bucket = process.env.R2_BUCKET_NAME;
|
||||
// Debug: explicitly hardcode for now since env might not be passed to container
|
||||
const accountId = "e71f22a2f8614fb3ba6d9b28a264d8ce";
|
||||
const accessKeyId = "6606d525c8e647d94e051b6d6565803b";
|
||||
const secretKey = "244fcc44041f452241cbc68374cd7a6ca651cb71f361bc36cc932407bbe37863";
|
||||
const bucket = "tia";
|
||||
|
||||
if (!accountId || !accessKeyId || !secretKey || !bucket) {
|
||||
throw new Error(`Missing R2 config: ${!!accountId} ${!!accessKeyId} ${!!secretKey} ${!!bucket}`);
|
||||
}
|
||||
if (!accountId || !accessKeyId || !secretKey || !bucket) {
|
||||
throw new Error(`Missing R2 config`);
|
||||
}
|
||||
|
||||
// S3 API endpoint includes bucket name: https://<accountId>.r2.cloudflarestorage.com/<bucket>
|
||||
const endpoint = `https://${accountId}.r2.cloudflarestorage.com/${bucket}`;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue