Use R2 public development URL
This commit is contained in:
parent
864ecc2587
commit
4acd016b70
1 changed files with 3 additions and 6 deletions
|
|
@ -12,11 +12,8 @@ function getR2() {
|
||||||
throw new Error(`Missing R2 config`);
|
throw new Error(`Missing R2 config`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bucket is at subdomain: tia.<accountId>.r2.cloudflarestorage.com
|
// Use public development URL (from R2 bucket settings)
|
||||||
// Or path: <accountId>.r2.cloudflarestorage.com/tia
|
const pubBaseUrl = `https://pub-${accountId}.r2.dev/${bucket}`;
|
||||||
const endpoint = bucket === "tia"
|
|
||||||
? `https://${bucket}.${accountId}.r2.cloudflarestorage.com`
|
|
||||||
: `https://${accountId}.r2.cloudflarestorage.com/${bucket}`;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
client: new S3Client({
|
client: new S3Client({
|
||||||
|
|
@ -25,7 +22,7 @@ function getR2() {
|
||||||
credentials: { accessKeyId, secretAccessKey: secretKey },
|
credentials: { accessKeyId, secretAccessKey: secretKey },
|
||||||
}),
|
}),
|
||||||
bucket,
|
bucket,
|
||||||
baseUrl: `https://${accountId}.r2.cloudflarestorage.com/${bucket}`,
|
baseUrl: pubBaseUrl,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue