Skip to content

Commit

Permalink
feat(blob): add domain in objecturl
Browse files Browse the repository at this point in the history
  • Loading branch information
Yougigun committed Nov 14, 2024
1 parent 279c241 commit 79db161
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type AppConfig struct {
Minio MinioConfig `koanf:"minio"`
Milvus MilvusConfig `koanf:"milvus"`
FileToEmbeddingWorker FileToEmbeddingWorker `koanf:"filetoembeddingworker"`
Blob BlobConfig `koanf:"blob"`
}

// OpenFGA config
Expand Down Expand Up @@ -159,6 +160,10 @@ type FileToEmbeddingWorker struct {
NumberOfWorkers int `koanf:"numberofworkers"`
}

type BlobConfig struct {
HostPort string `koanf:"hostport"`
}

// Init - Assign global config to decoded config struct
func Init() error {
k := koanf.New(".")
Expand Down
2 changes: 2 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ milvus:
port: 19530
filetoembeddingworker:
numberofworkers: 2
blob:
hostport: http://localhost:8080
3 changes: 2 additions & 1 deletion pkg/service/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/gofrs/uuid"
"github.com/gogo/status"
"github.com/instill-ai/artifact-backend/config"
"github.com/instill-ai/artifact-backend/pkg/logger"
minio_local "github.com/instill-ai/artifact-backend/pkg/minio"
"github.com/instill-ai/artifact-backend/pkg/repository"
Expand Down Expand Up @@ -228,7 +229,7 @@ func EncodedMinioURLPath(namespaceID string, objectURLUUID uuid.UUID) string {
urlPath := path.Join("v1alpha", "namespaces", namespaceID, "blob-urls", objectURLUUID.String())

// Ensure the path starts with a forward slash
return "/" + urlPath
return config.Config.Blob.HostPort + "/" + urlPath
}

// DecodeMinioURLPath decodes the minio URL path into namespaceID and objectName
Expand Down

0 comments on commit 79db161

Please sign in to comment.