Skip to content

Commit b5652b6

Browse files
authored
Merge pull request #107 from johnolafenwa/feat-port-setting
Feat port setting
2 parents b20179b + 19b68a3 commit b5652b6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/server.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,10 +850,17 @@ func main() {
850850
flag.StringVar(&apiKey, "API-KEY", os.Getenv("API-KEY"), "api key to secure endpoints")
851851
flag.StringVar(&adminKey, "ADMIN-KEY", os.Getenv("ADMIN-KEY"), "admin key to secure admin endpoints")
852852
flag.StringVar(&modelStoreDetection, "MODELSTORE-DETECTION", "/modelstore/detection/", "path to custom detection models")
853-
flag.IntVar(&port, "PORT", 5000, "port")
854853
flag.Float64Var(&request_timeout, "TIMEOUT", 60, "request timeout in seconds")
855854
flag.StringVar(&mode, "MODE", "Medium", "performance mode")
856855

856+
getPort := os.Getenv("PORT")
857+
intPortVal, err := strconv.Atoi(getPort)
858+
if err != nil{
859+
flag.IntVar(&port, "PORT", 5000, "port")
860+
}else{
861+
flag.IntVar(&port, "PORT", intPortVal, "port")
862+
}
863+
857864
flag.Parse()
858865

859866
PROFILE := os.Getenv("PROFILE")

0 commit comments

Comments
 (0)