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

feat(blob): add domain in objecturl #130

Merged
merged 1 commit into from
Nov 14, 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
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
Loading