update s3 endpoint handling

virtual host extracts bucket name from endpoint environment variable;
path uses fixed bucket name
This commit is contained in:
Michael Hohn
2025-05-13 10:47:54 -07:00
committed by =Michael Hohn
parent bde8ac2db7
commit 5bdbd60cc5
5 changed files with 62 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ import (
// XX: static types: split by type?
// Restrict the keys / values and centralize the common ones here
const (
var (
QL_DB_BUCKETNAME = "mrvabucket"
)
@@ -23,11 +23,13 @@ type MinIOCodeQLDatabaseStore struct {
bucketName string
}
func NewMinIOCodeQLDatabaseStore(endpoint, id, secret string) (*MinIOCodeQLDatabaseStore, error) {
func NewMinIOCodeQLDatabaseStore(endpoint, id, secret string,
lookup minio.BucketLookupType) (*MinIOCodeQLDatabaseStore, error) {
minioClient, err := minio.New(endpoint, &minio.Options{
Creds: credentials.NewStaticV4(id, secret, ""),
Secure: false,
BucketLookup: minio.BucketLookupDNS, // Enable virtual-host-style addressing
BucketLookup: lookup,
})
if err != nil {
return nil, err