#Switching between s3 and local media files
1 messages · Page 1 of 1 (latest)
The easiest way to do this would be to have an environment variables that is referenced inside your payload config, then conditionally use the plugin. Something similar can be seen here: https://github.com/payloadcms/plugin-cloud-storage/blob/master/dev/src/payload.config.ts
tried that, unfortunately it doesn't work 😦 ended up using minio to replicate s3 on my local machine. It works okay like that.
Interesting, I don't see any reason why that wouldn't work. Glad you were able to find a solution 👍
We managed to have S3 on production and local files on dev simply with this; basically it’ll send an empty object on dev so the plugin doesn’t throw an error
cloudStorage({
collections: process.env.NODE_ENV !== 'development' && {
media: {
adapter,
},
},
}),
yep