Skip to content

Commit

Permalink
Merge d4dd84b into bb105e3
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle committed Feb 20, 2024
2 parents bb105e3 + d4dd84b commit ac0fa50
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ const validateS3BucketUrl = (
}
// Region should be specified correctly in production
const isRegionCorrect = new RegExp(`^https://s3.${region}.amazonaws.com`, 'i')
if (!isDev && !isRegionCorrect.test(val)) {
throw new Error(`region should be ${region}`)
const isR2 = new RegExp(`^https://\\w+.r2.cloudflarestorage.com`, 'i')
if (!isDev && !isRegionCorrect.test(val) && !isR2.test(val)) {
throw new Error(
`region should be ${region}, or url should be for Cloudflare R2`,
)
}
/* eslint-enable typesafe/no-throw-sync-func */
}
Expand Down

0 comments on commit ac0fa50

Please sign in to comment.