Skip to content

Commit

Permalink
fix(datastore): storagebackend panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-pad committed Apr 26, 2024
1 parent b3abca5 commit 3a144ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion internal/datastore/storage/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ import (
// Implements Storage interface using Google Cloud Storage
type GCS struct {
// GCS Blob Storage client
Client storage.Client
Client *storage.Client
Config config.GCSConfig
}

// New creates a new Google Cloud Storage client
func New(config config.GCSConfig) *GCS {
client, err := storage.NewClient(context.Background())
if err != nil {
panic(err)
}
return &GCS{
Config: config,
Client: client,
}
}

Expand Down
6 changes: 5 additions & 1 deletion internal/datastore/storage/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"io"

"github.com/aws/aws-sdk-go/aws/session"
storage "github.com/aws/aws-sdk-go/service/s3"
"github.com/padok-team/burrito/internal/burrito/config"
)
Expand All @@ -12,14 +13,17 @@ import (

type S3 struct {
// GCS Blob Storage client
Client storage.S3
Client *storage.S3
Config config.S3Config
}

// New creates a new Google Cloud Storage client
func New(config config.S3Config) *S3 {
session := session.Must(session.NewSession())
client := storage.New(session)
return &S3{
Config: config,
Client: client,
}
}

Expand Down

0 comments on commit 3a144ee

Please sign in to comment.