Fix for the issue: https://github.com/GoogleCloudPlatform/microservices-demo/issues/80
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:
parent
a815e029ab
commit
2283bd2921
4 changed files with 8 additions and 3 deletions
|
@ -19,6 +19,7 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
hosts:
|
hosts:
|
||||||
- www.ecb.europa.eu
|
- www.ecb.europa.eu
|
||||||
|
- amer-demo4-test.apigee.net
|
||||||
ports:
|
ports:
|
||||||
- number: 80
|
- number: 80
|
||||||
name: http
|
name: http
|
||||||
|
|
|
@ -25,7 +25,8 @@ spec:
|
||||||
terminationGracePeriodSeconds: 5
|
terminationGracePeriodSeconds: 5
|
||||||
containers:
|
containers:
|
||||||
- name: server
|
- 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:
|
ports:
|
||||||
- name: grpc
|
- name: grpc
|
||||||
containerPort: 7000
|
containerPort: 7000
|
||||||
|
@ -42,6 +43,9 @@ spec:
|
||||||
limits:
|
limits:
|
||||||
cpu: 200m
|
cpu: 200m
|
||||||
memory: 128Mi
|
memory: 128Mi
|
||||||
|
env:
|
||||||
|
- name: DATA_URL
|
||||||
|
value: "http://amer-demo4-test.apigee.net/currency-service"
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
|
|
@ -61,6 +61,6 @@ client.convert(request, (err, response) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(`Error in convert: ${err}`);
|
logger.error(`Error in convert: ${err}`);
|
||||||
} else {
|
} else {
|
||||||
logger.log(`Convert: ${_moneyToString(request.from)} to ${_moneyToString(response)}`);
|
logger.info(`Convert: ${_moneyToString(request.from)} to ${_moneyToString(response)}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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 HEALTH_PROTO_PATH = path.join(__dirname, './proto/grpc/health/v1/health.proto');
|
||||||
|
|
||||||
const PORT = 7000;
|
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 shopProto = _loadProto(MAIN_PROTO_PATH).hipstershop;
|
||||||
const healthProto = _loadProto(HEALTH_PROTO_PATH).grpc.health.v1;
|
const healthProto = _loadProto(HEALTH_PROTO_PATH).grpc.health.v1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue