Configuring the Application for Deployment

Learn how to set up configuration file when working with Heroku.

We'll cover the following

We now have an application that, when code is pushed to git, starts the process of building an image and deploying it. Our application currently gets deployed, but it’s not actually working, and this is happening because it’s lacking configuration.

The first thing you probably noticed is that our application is always loading the configuration file from development, config.dev.yml, and it shouldn’t.

When we first implemented this, we thought that different environments would have different configurations, and we were right. At the time, we didn’t need to have configurations for more than one environment, and we used dev as a default. Let’s fix that.

Steps to configure an application

Remember that when we created the function that loads the configuration, we explicitly used an argument for the environment? We didn’t use it at the time, but we left a default value.

Look at the following code snippet from src/config/index.ts:

Get hands-on with 1200+ tech skills courses.