Configuring our application
Right now, we are storing our database URL in a .env
file. This is fine, but we can also use yaml
config
files. When developing web servers, they will be run in different environments. For instance, right now, we are running our Rust server on our local machine. However, later we will package the server into our own Docker image and deploy it on the cloud. With microservices infrastructure, we might use a server that we built in one cluster and slot it into a different cluster with different databases to connect to. Because of this, config files defining all inward and outward traffic become essential. When we deploy our server, we can make a request to file storage, such as AWS S3, to get the right config file for the server. It must be noted that environment variables can be preferred for deployment as they can be passed into containers. We will cover how to configure a web application using environment variables in Chapter 13, Best Practices for a Clean...