July 2017
Intermediate to advanced
656 pages
16h 1m
English
While we have only made minor code changes to the system, organizationally these changes are important.
We removed any hard coded service configuration information from the code.
In the file micro/adderservice/wiring.js, we take the port assignment from an environment variable (ADDERSERVICE_SERVICE_PORT is destructured from the process.env near the top of wiring.js):
server.listen(ADDERSERVICE_SERVICE_PORT, '0.0.0.0', () => { console.log('%s listening at %s', server.name, server.url)})
This means that the port that the service is listening on is now supplied by the environment. While it might be fine to hard code this information for a small system, it quickly becomes unmanageable in a larger system, so this approach to service ...