@@ -207,33 +207,35 @@ func BundleFileGroup(repo repository.Repository, s3Client *s3.Client) func(c *gi
207207 return
208208 }
209209
210- go func (filePath string ) {
211- keyName := filepath .Base (filePath )
212- bundledFile , err := os .Open (filePath )
213- if err != nil {
214- log .Printf ("Error reading bundled file at %s, is the file removed? %s" , filePath , err .Error ())
215- return
216- }
217- defer bundledFile .Close ()
210+ if appConfig .IsUsingS3Storage () {
211+ go func (filePath string ) {
212+ keyName := filepath .Base (filePath )
213+ bundledFile , err := os .Open (filePath )
214+ if err != nil {
215+ log .Printf ("Error reading bundled file at %s, is the file removed? %s" , filePath , err .Error ())
216+ return
217+ }
218+ defer bundledFile .Close ()
218219
219- _ , err = s3Client .PutObject (context .Background (), & s3.PutObjectInput {
220- Bucket : aws .String (appConfig .GetS3Bucket ()),
221- Key : & keyName ,
222- Body : bundledFile ,
223- Expires : fileGroup .ExpiredAt , // cache expiration
224- })
220+ _ , err = s3Client .PutObject (context .Background (), & s3.PutObjectInput {
221+ Bucket : aws .String (appConfig .GetS3Bucket ()),
222+ Key : & keyName ,
223+ Body : bundledFile ,
224+ Expires : fileGroup .ExpiredAt , // cache expiration
225+ })
225226
226- if err == nil {
227- fileGroup .FileKey = keyName
228- db .Save (& fileGroup )
227+ if err == nil {
228+ fileGroup .FileKey = keyName
229+ db .Save (& fileGroup )
229230
230- // remove local file because already uploaded to S3
231- os .Remove (filePath )
232- return
233- }
231+ // remove local file because already uploaded to S3
232+ os .Remove (filePath )
233+ return
234+ }
234235
235- log .Println ("error S3 upload" , err )
236- }(fileGroup .FileKey )
236+ log .Println ("error S3 upload" , err )
237+ }(fileGroup .FileKey )
238+ }
237239
238240 pinCode := ""
239241
0 commit comments