recommendationservice: require PRODUCT_CATALOG_SERVICE_ADDR
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
7b06cf63b0
commit
1372aad813
2 changed files with 5 additions and 5 deletions
|
@ -8,9 +8,7 @@ ADD ./*.py /home/
|
||||||
WORKDIR /home
|
WORKDIR /home
|
||||||
|
|
||||||
# set listen port
|
# set listen port
|
||||||
ENV PORT="8080"
|
ENV PORT "8080"
|
||||||
|
EXPOSE 8080
|
||||||
#set product catalog address
|
|
||||||
ENV PRODUCT_CATALOG_SERVICE_ADDR="localhost:8081"
|
|
||||||
|
|
||||||
ENTRYPOINT python /home/recommendation_server.py
|
ENTRYPOINT python /home/recommendation_server.py
|
||||||
|
|
|
@ -30,7 +30,9 @@ if __name__ == "__main__":
|
||||||
# get port from $PORT envar
|
# get port from $PORT envar
|
||||||
port = os.environ.get('PORT', "8080")
|
port = os.environ.get('PORT', "8080")
|
||||||
# get product catalog service address from $PRODUCT_CATALOG_SERVICE_ADDR envar
|
# get product catalog service address from $PRODUCT_CATALOG_SERVICE_ADDR envar
|
||||||
catalog_addr = os.environ.get('PRODUCT_CATALOG_SERVICE_ADDR', "localhost:8081")
|
catalog_addr = os.environ.get('PRODUCT_CATALOG_SERVICE_ADDR', '')
|
||||||
|
if catalog_addr == "":
|
||||||
|
raise Exception('PRODUCT_CATALOG_SERVICE_ADDR environment not set')
|
||||||
|
|
||||||
print("product catalog address: " + catalog_addr)
|
print("product catalog address: " + catalog_addr)
|
||||||
print("listening on port: " + port)
|
print("listening on port: " + port)
|
||||||
|
|
Loading…
Reference in a new issue