Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use empty path for minio config #5713

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading