mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-26 09:26:12 +01:00
Support for additional S3 providers (#71)
* support for other s3 providers * remove redundant route options * use type safe env * prettier
This commit is contained in:
@@ -1,14 +1,27 @@
|
||||
/**
|
||||
* Undefined entries are not supported. Push optional patterns to this array only if defined.
|
||||
* @type {import('next/dist/shared/lib/image-config').RemotePattern}
|
||||
*/
|
||||
const remotePatterns = []
|
||||
|
||||
// S3 Storage
|
||||
if (process.env.S3_UPLOAD_ENDPOINT) {
|
||||
// custom endpoint for providers other than AWS
|
||||
const url = new URL(process.env.S3_UPLOAD_ENDPOINT);
|
||||
remotePatterns.push({
|
||||
hostname: url.hostname,
|
||||
})
|
||||
} else if (process.env.S3_UPLOAD_BUCKET && process.env.S3_UPLOAD_REGION) {
|
||||
// default provider
|
||||
remotePatterns.push({
|
||||
hostname: `${process.env.S3_UPLOAD_BUCKET}.s3.${process.env.S3_UPLOAD_REGION}.amazonaws.com`,
|
||||
})
|
||||
}
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
images: {
|
||||
remotePatterns:
|
||||
process.env.S3_UPLOAD_BUCKET && process.env.S3_UPLOAD_REGION
|
||||
? [
|
||||
{
|
||||
hostname: `${process.env.S3_UPLOAD_BUCKET}.s3.${process.env.S3_UPLOAD_REGION}.amazonaws.com`,
|
||||
},
|
||||
]
|
||||
: [],
|
||||
remotePatterns
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user