@@ -177,17 +177,16 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
177177
178178 *********************************************************************************/
179179 new UploadPlugin ( {
180- storageAdapter : new AdminForthStorageAdapterLocalFilesystem ( {
180+ storageAdapter : process . env . USE_S3 !== 'true' ? new AdminForthStorageAdapterLocalFilesystem ( {
181181 fileSystemFolder : "./db/uploads" ,
182182 mode : "public" , // or "private"
183183 signingSecret : '1241245' ,
184+ } ) : new AdminForthAdapterS3Storage ( {
185+ bucket : process . env . AWS_BUCKET_NAME as string ,
186+ region : process . env . AWS_REGION as string ,
187+ accessKeyId : process . env . AWS_ACCESS_KEY_ID as string ,
188+ secretAccessKey : process . env . AWS_SECRET_ACCESS_KEY as string ,
184189 } ) ,
185- // storageAdapter: new AdminForthAdapterS3Storage({
186- // bucket: process.env.AWS_BUCKET_NAME as string,
187- // region: process.env.AWS_REGION as string,
188- // accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,
189- // secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,
190- // }),
191190 pathColumnName : 'photos' ,
192191 allowedFileExtensions : [ 'jpg' , 'jpeg' , 'png' , 'gif' , 'webm' , 'webp' ] ,
193192 maxFileSize : 1024 * 1024 * 20 , // 20 MB
@@ -198,17 +197,16 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
198197 } ,
199198 } ) ,
200199 new UploadPlugin ( {
201- storageAdapter : new AdminForthStorageAdapterLocalFilesystem ( {
200+ storageAdapter : process . env . USE_S3 !== 'true' ? new AdminForthStorageAdapterLocalFilesystem ( {
202201 fileSystemFolder : "./db/uploads_promo" ,
203202 mode : "public" , // or "private"
204203 signingSecret : '1241245' ,
204+ } ) : new AdminForthAdapterS3Storage ( {
205+ bucket : process . env . AWS_BUCKET_NAME as string ,
206+ region : process . env . AWS_REGION as string ,
207+ accessKeyId : process . env . AWS_ACCESS_KEY_ID as string ,
208+ secretAccessKey : process . env . AWS_SECRET_ACCESS_KEY as string ,
205209 } ) ,
206- // storageAdapter: new AdminForthAdapterS3Storage({
207- // bucket: process.env.AWS_BUCKET_NAME as string,
208- // region: process.env.AWS_REGION as string,
209- // accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,
210- // secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,
211- // }),
212210 pathColumnName : 'promo_picture' ,
213211 allowedFileExtensions : [ 'jpg' , 'jpeg' , 'png' , 'gif' , 'webm' , 'webp' ] ,
214212 maxFileSize : 1024 * 1024 * 20 , // 20 MB
@@ -275,17 +273,17 @@ export default function carsResourseTemplate(resourceId: string, dataSource: str
275273 ...( process . env . OPENAI_API_KEY ?
276274 [
277275 new UploadPlugin ( {
278- storageAdapter : new AdminForthStorageAdapterLocalFilesystem ( {
276+ storageAdapter : process . env . USE_S3 !== 'true' ? new AdminForthStorageAdapterLocalFilesystem ( {
279277 fileSystemFolder : "./db/uploads_promo_generated" ,
280278 mode : "public" , // or "private"
281279 signingSecret : '1241245' ,
280+ } ) : new AdminForthAdapterS3Storage ( {
281+ bucket : process . env . AWS_BUCKET_NAME as string ,
282+ region : process . env . AWS_REGION as string ,
283+ accessKeyId : process . env . AWS_ACCESS_KEY_ID as string ,
284+ secretAccessKey : process . env . AWS_SECRET_ACCESS_KEY as string ,
282285 } ) ,
283- // storageAdapter: new AdminForthAdapterS3Storage({
284- // bucket: process.env.AWS_BUCKET_NAME as string,
285- // region: process.env.AWS_REGION as string,
286- // accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,
287- // secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,
288- // }),
286+
289287 pathColumnName : 'generated_promo_picture' ,
290288 allowedFileExtensions : [ 'jpg' , 'jpeg' , 'png' , 'gif' , 'webm' , 'webp' ] ,
291289 maxFileSize : 1024 * 1024 * 20 , // 20 MB
0 commit comments