Skip to content

Commit

Permalink
fix: use empty path for minio config (#5713)
Browse files Browse the repository at this point in the history
* fix: use empty path for minio config

Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>

* fix: unit tests

Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>

---------

Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>
  • Loading branch information
vsukhin committed Jul 31, 2024
1 parent 80ee9b5 commit a347505
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/logs-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func main() {
cfg.StorageCAFile)

minioAdapter.
WithPath(cfg.StorageFilePath)
WithNonEmptyPath(cfg.StorageFilePath)

if err != nil {
log.Errorw("error creating minio adapter", "error", err)
Expand Down
6 changes: 4 additions & 2 deletions pkg/logs/adapter/minio_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ func (s *MinioV2Adapter) deleteFile(id string) {
delete(s.files, id)
}

func (s *MinioV2Adapter) WithPath(path string) {
s.path = path
func (s *MinioV2Adapter) WithNonEmptyPath(path string) {
if path != "" {
s.path = path
}
}

func (s *MinioV2Adapter) Notify(ctx context.Context, id string, e events.Log) error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/logs/adapter/minio_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestLogsV2Local(t *testing.T) {
t.Skip("only local")
ctx := context.Background()
consumer, _ := NewMinioV2Adapter(cfg.StorageEndpoint, cfg.StorageAccessKeyID, cfg.StorageSecretAccessKey, cfg.StorageRegion, cfg.StorageToken, "test-1", cfg.StorageSSL, cfg.StorageSkipVerify, cfg.StorageCertFile, cfg.StorageKeyFile, cfg.StorageCAFile)
consumer.WithPath("./")
consumer.WithNonEmptyPath("./")
id := "test-bla"
err := consumer.Init(ctx, id)
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/logs/config/logs_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Config struct {
StorageCertFile string `envconfig:"STORAGE_CERT_FILE" default:""`
StorageKeyFile string `envconfig:"STORAGE_KEY_FILE" default:""`
StorageCAFile string `envconfig:"STORAGE_CA_FILE" default:""`
StorageFilePath string `envconfig:"STORAGE_FILE_PATH" default:"/data"`
StorageFilePath string `envconfig:"STORAGE_FILE_PATH" default:""`
}

func Get() (*Config, error) {
Expand Down

0 comments on commit a347505

Please sign in to comment.