fix product catalog servicde ports

This commit is contained in:
Abhilash Gnan 2019-05-04 14:32:13 +02:00
parent 3d24a46a41
commit e0f2f5ec4a
2 changed files with 11 additions and 5 deletions

View file

@ -31,6 +31,9 @@ spec:
image: productcatalogservice image: productcatalogservice
ports: ports:
- containerPort: 3550 - containerPort: 3550
env:
- name: PORT
value: "3550"
readinessProbe: readinessProbe:
exec: exec:
command: ["/bin/grpc_health_probe", "-addr=:3550"] command: ["/bin/grpc_health_probe", "-addr=:3550"]

View file

@ -50,7 +50,7 @@ var (
log *logrus.Logger log *logrus.Logger
extraLatency time.Duration extraLatency time.Duration
port = flag.Int("port", 3550, "port to listen at") port = "3550"
reloadCatalog bool reloadCatalog bool
) )
@ -106,13 +106,16 @@ func main() {
} }
}() }()
log.Infof("starting grpc server at :%d", *port) if os.Getenv("PORT") != "" {
run(*port) port = os.Getenv("PORT")
}
log.Infof("starting grpc server at :%s", port)
run(port)
select {} select {}
} }
func run(port int) string { func run(port string) string {
l, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) l, err := net.Listen("tcp", fmt.Sprintf(":%s", port))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }