package initialize

import (
	"context"
	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
)

func Minio(ctx context.Context, cfg Config) (*minio.Client, error) {
	conn, err := minio.New(cfg.MinioEndpoint,
		&minio.Options{
			Creds:  credentials.NewStaticV4(cfg.MinioAccessKey, cfg.MinioSecretKey, cfg.MinioToken),
			Secure: false,
		},
	)
	if err != nil {
		return nil, err
	}

	return conn, nil
}
