Updated server.js to use Env variable, instead of hardcoded currency URL
Hosting a currency service, that is serving via http
updated the manifests to include the env and egress whitelisting
This commit is contained in:
mukundha 2018-10-17 09:32:02 +01:00
parent a815e029ab
commit 2283bd2921
4 changed files with 8 additions and 3 deletions

View file

@ -19,6 +19,7 @@ metadata:
spec:
hosts:
- www.ecb.europa.eu
- amer-demo4-test.apigee.net
ports:
- number: 80
name: http

View file

@ -25,7 +25,8 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/microservices-demo-app/currencyservice
#image: gcr.io/microservices-demo-app/currencyservice
image: us.gcr.io/hipster-apim-demo/currencyservice
ports:
- name: grpc
containerPort: 7000
@ -42,6 +43,9 @@ spec:
limits:
cpu: 200m
memory: 128Mi
env:
- name: DATA_URL
value: "http://amer-demo4-test.apigee.net/currency-service"
---
apiVersion: v1
kind: Service

View file

@ -61,6 +61,6 @@ client.convert(request, (err, response) => {
if (err) {
logger.error(`Error in convert: ${err}`);
} else {
logger.log(`Convert: ${_moneyToString(request.from)} to ${_moneyToString(response)}`);
logger.info(`Convert: ${_moneyToString(request.from)} to ${_moneyToString(response)}`);
}
});

View file

@ -39,7 +39,7 @@ const MAIN_PROTO_PATH = path.join(__dirname, './proto/demo.proto');
const HEALTH_PROTO_PATH = path.join(__dirname, './proto/grpc/health/v1/health.proto');
const PORT = 7000;
const DATA_URL = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';
const DATA_URL = process.env.DATA_URL //'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';
const shopProto = _loadProto(MAIN_PROTO_PATH).hipstershop;
const healthProto = _loadProto(HEALTH_PROTO_PATH).grpc.health.v1;