Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrodjpl committed Aug 30, 2024
1 parent dbafddc commit fc9ae59
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/internal/aws/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,15 @@ func CreateBucket(s3client S3BucketAPI, conf *appconfig.AppConfig) {
log.Errorf("Error enabling versioning on bucket: %v", berr)
return
}
} else {
log.Infof("Bucket %s exists", bucket)


bucketLifecycleInDaysParamPath := fmt.Sprintf("/unity/%s/%s/cs/monitoring/s3/bucketLifecycleInDays", conf.Project, conf.Venue)
bucketLifecylceInDaysParam, err := ReadSSMParameter(bucketLifecycleInDaysParamPath)

defaultBucketLifecycleInDays := int32(7)
bucketLifecycleInDays := defaultBucketLifecycleInDays

if err != nil {
log.Infof("Lifecycle in days SSM param (%s) not defined, using default value of %d days.", bucketLifecycleInDaysParamPath, defaultBucketLifecycleInDays)
log.Infof("Lifecycle in days SSM param (%s) not defined, using default value of %d days.", bucketLifecycleInDaysParamPath, defaultBucketLifecycleInDays)
} else {
bucketLifecycleInDaysInt, err := strconv.Atoi(*bucketLifecylceInDaysParam.Parameter.Value)

Expand All @@ -180,12 +178,14 @@ func CreateBucket(s3client S3BucketAPI, conf *appconfig.AppConfig) {

// Set bucket lifecycle length
log.Printf("Setting lifecycle length on bucket: %s", bucket)
berr := SetBucketLifecycleLength(s3client, conf, bucket, bucketLifecycleInDays)
berr = SetBucketLifecycleLength(s3client, conf, bucket, bucketLifecycleInDays)

if berr != nil {
log.Errorf("Error setting lifecycle length on bucket: %v", berr)
return
}
} else {
log.Infof("Bucket %s exists", bucket)
}
}

Expand Down

0 comments on commit fc9ae59

Please sign in to comment.