update routes

This commit is contained in:
2026-05-16 11:10:36 +07:00
parent f1c69c0f1f
commit f23a0c2152
7 changed files with 64 additions and 39 deletions
+19 -6
View File
@@ -7,7 +7,8 @@ import (
)
const (
ClientPort = ":8100"
GrpcGatewayPort = ":8090"
UserClientPort = ":8100"
AdminClientPort = ":8110"
FilePort = ":8120"
)
@@ -20,7 +21,19 @@ func GetDBFilepath() string {
return getFilepath("DB_FILENAME", "data/db/store.db")
}
func GetAdminHost() string {
func GetGrpcGatewayHost() string {
host := os.Getenv("HOST")
if host != "" {
return host
}
ips, err := getLocalIPs()
if err != nil || len(ips) == 0 {
return "http://127.0.0.1" + GrpcGatewayPort
}
return "http://" + ips[0] + GrpcGatewayPort
}
func GetAdminClientHost() string {
host := os.Getenv("HOST")
if host != "" {
return host
@@ -32,20 +45,20 @@ func GetAdminHost() string {
return "http://" + ips[0] + AdminClientPort
}
func GetHost() string {
func GetUserClientHost() string {
host := os.Getenv("HOST")
if host != "" {
return host
}
ips, err := getLocalIPs()
if err != nil || len(ips) == 0 {
return "http://127.0.0.1" + ClientPort
return "http://127.0.0.1" + UserClientPort
}
return "http://" + ips[0] + ClientPort
return "http://" + ips[0] + UserClientPort
}
func GetFileHost() string {
host := os.Getenv("FILE_HOST")
host := os.Getenv("HOST")
if host != "" {
return host
}