Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
soneda-yuya committed Jan 27, 2025
1 parent 4f56069 commit b5ba8f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/internal/app/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func initFile(ctx context.Context, conf *config.Config) (fileRepo gateway.File)
var err error
if conf.GCS.IsConfigured() {
log.Infofc(ctx, "file: GCS storage is used: %s\n", conf.GCS.BucketName)
fileRepo, err = gcs.NewFile(conf.Dev, conf.GCS.BucketName, conf.AssetBaseURL, conf.GCS.PublicationCacheControl)
fileRepo, err = gcs.NewFile(false, conf.GCS.BucketName, conf.AssetBaseURL, conf.GCS.PublicationCacheControl)
if err != nil {
log.Warnf("file: failed to init GCS storage: %s\n", err.Error())
}
Expand Down
8 changes: 4 additions & 4 deletions server/internal/infrastructure/gcs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
)

type fileRepo struct {
isDev bool
isTest bool
bucketName string
base *url.URL
cacheControl string
Expand All @@ -43,7 +43,7 @@ const (
devBaseURL = "http://localhost:4443/storage/v1/b"
)

func NewFile(isDev bool, bucketName, base string, cacheControl string) (gateway.File, error) {
func NewFile(isTest bool, bucketName, base string, cacheControl string) (gateway.File, error) {
if bucketName == "" {
return nil, errors.New("bucket name is empty")
}
Expand All @@ -60,7 +60,7 @@ func NewFile(isDev bool, bucketName, base string, cacheControl string) (gateway.
}

return &fileRepo{
isDev: isDev,
isTest: isTest,
bucketName: bucketName,
base: u,
cacheControl: cacheControl,
Expand Down Expand Up @@ -296,7 +296,7 @@ func (f *fileRepo) RemoveExportProjectZip(ctx context.Context, filename string)

func (f *fileRepo) bucket(ctx context.Context) (*storage.BucketHandle, error) {
opts := []option.ClientOption{}
if f.isDev {
if f.isTest {
opts = append(opts, option.WithoutAuthentication(), option.WithEndpoint(devBaseURL))
}
client, err := storage.NewClient(ctx, opts...)
Expand Down

0 comments on commit b5ba8f8

Please sign in to comment.