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
ports:
- containerPort: 3550
env:
- name: PORT
value: "3550"
readinessProbe:
exec:
command: ["/bin/grpc_health_probe", "-addr=:3550"]

View file

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