Packaging your application with Docker and Compose
It’s time that we moved on to packaging and deploying our application using Compose. In order to achieve this, the requisite is to create a Docker image for our application. Before we go in that direction, we need to adapt our code base so it can run in different environments without having to change the code and generate another image.
Enabling environment configuration
By examining the code base, we can see that certain configurations are subject to change. Redis configuration should be flexible since a Redis server, as long as it is accessible to our code base, can be located everywhere. For this reason, the Redis client will derive the configurations through environment variables. However, if there were no configurations provided, it should fall back to a default configuration.
The following utility function will assist us with this. In the case of no environment variable being provided, a default value will be...