This commit is contained in:
gitGnome
2026-04-14 14:11:38 +02:00
parent 2500418f80
commit a020c13394
2 changed files with 12 additions and 3 deletions
+9 -3
View File
@@ -9,10 +9,13 @@ import (
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
) )
var dbConn *minio.Client
func MinInit() { func MinInit() {
ctx := context.Background() ctx := context.Background()
dbConn, err := minio.New("localhost:9000", &minio.Options{ var err error
dbConn, err = minio.New("localhost:9000", &minio.Options{
Creds: credentials.NewStaticV4("root", "change_to_env", ""), Creds: credentials.NewStaticV4("root", "change_to_env", ""),
Secure: false, Secure: false,
}) // TODO change in production }) // TODO change in production
@@ -33,6 +36,9 @@ func MinInit() {
} }
} }
func putFile(ctx context.Context, key string, reader io.Reader, size uint32, contentType string) error { func putFile(ctx context.Context, key string, reader io.Reader, size uint32, contentType string, meta map[string]string) error {
dbConn.PutObject(ctx, globals.FileStorageBucketName, key, reader, int64(size), minio.PutObjectOptions{
ContentType: contentType,
UserMetadata: meta,
})
} }
+3
View File
@@ -102,3 +102,6 @@ type WsAuthMessage struct {
Success bool `json:"success"` Success bool `json:"success"`
Error string `json:"error"` Error string `json:"error"`
} }
type Metadata struct {
}