Skip to content

Commit a826bbd

Browse files
committed
chore: use one-string URL for similarity and export service within mb3server
1 parent febfc21 commit a826bbd

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

compose/docker-compose.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ services:
4444
DB_NAME: ${DB_NAME}
4545
DB_USER: ${DB_USER}
4646
MB3_SERVER_PORT: ${MB3_SERVER_PORT}
47-
SIMILARITY_SERVICE_COSINE_HOST: similarity-service
48-
SIMILARITY_SERVICE_COSINE_PORT: 8080
49-
EXPORT_SERVICE_HOST: export-service
50-
EXPORT_SERVICE_PORT: 8080
47+
SIMILARITY_SERVICE_COSINE_URL: http://similarity-service:8080
48+
EXPORT_SERVICE_URL: http://export-service:8080
5149
MB3_API_URL: http://${MB3_API_HOST}:${MB3_API_PORT}
5250
MB3_API_BASE_URL: ${MB3_API_BASE_URL}
5351

pkg/mb3server/api-impl.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,8 @@ func GetStatus() (GetStatus200Response, error) {
573573
postgresStatus.Error = err.Error()
574574
}
575575

576-
hostname := getEnv("EXPORT_SERVICE_HOST", "export-service")
577-
port := getEnv("EXPORT_SERVICE_PORT", "8080")
578-
requestURL := "http://" + hostname + ":" + port + "/version"
576+
exportServiceUrl := getEnv("EXPORT_SERVICE_URL", "http://export-service:8080")
577+
requestURL := exportServiceUrl + "/version"
579578
res, err := http.Get(requestURL)
580579
if err != nil {
581580
export_service_status.Status = "ERROR"
@@ -587,9 +586,8 @@ func GetStatus() (GetStatus200Response, error) {
587586
}
588587
}
589588

590-
hostname = getEnv("SIMILARITY_SERVICE_COSINE_HOST", "similarity-service-cosine")
591-
port = getEnv("SIMILARITY_SERVICE_COSINE_PORT", "8080")
592-
requestURL = "http://" + hostname + ":" + port + "/version"
589+
similarityServiceUrl := getEnv("SIMILARITY_SERVICE_COSINE_URL", "http://similarity-service:8080")
590+
requestURL = similarityServiceUrl + "/version"
593591
res, err = http.Get(requestURL)
594592
if err != nil {
595593
similarity_service_status.Status = "ERROR"
@@ -1044,9 +1042,8 @@ func GetSimilarity(peakList []string, threshold float64, referenceSpectraList []
10441042
peakListParam = append(peakListParam, datatype1{Mz: mz, Intensity: rel})
10451043
}
10461044

1047-
hostname := getEnv("SIMILARITY_SERVICE_COSINE_HOST", "similarity-service-cosine")
1048-
port := getEnv("SIMILARITY_SERVICE_COSINE_PORT", "8080")
1049-
requestURL := "http://" + hostname + ":" + port + "/similarity"
1045+
similarityServiceUrl := getEnv("SIMILARITY_SERVICE_COSINE_URL", "http://similarity-service:8080")
1046+
requestURL := similarityServiceUrl + "/similarity"
10501047

10511048
type datatype2 struct {
10521049
PeakList []datatype1 `json:"peak_list"`

0 commit comments

Comments
 (0)