loading

What is Configuration as Code?| Hitchhikers Platform

What You’ll Learn

In this section, you will learn:

  • What Configuration as Code is
  • How Configuration as Code helps users manage accounts
  • What Configuration as Code looks like

Early Computers and Programs

Early computers were very different from their modern-day counterparts. They were large machines that took up tons of space and electricity and were limited in function.

Like modern computers, these machines ran programs. Unlike modern computers, running a program was a very manual and tedious process. People needed to flip switches, turn dials, and punch holes in cards in a specific order to run a specific program. Mistakes would often force the person to start the program from the beginning. The execution of the program was intertwined with the configuration of the physical machine.

If a person wanted to then run a different program, they would need to configure the computer differently. Since these machines were complicated with many potential permutations, the configuration for various programs was documented so that programmers could reference it and reproduce it. Every time a person wanted to run a program, they would look at the reference documentation and then configure the machine by flipping switches and turning dials.

There had to be a better way! Sure enough, one was soon discovered.

If a computer could store the instructions for a program in electronic memory, it could execute the program without the need for anyone to flip a switch or turn a dial. A person would simply need to indicate to the computer which stored file contained the instructions for the program, and the computer could do the rest. Switching between programs would be easy. Taking a program that works on one computer and using it on another would also be easy. And thus, software was born.

Web Applications

At first glance, modern web applications have very little in common with early computers. Their capabilities alone far exceed anything that the users of those early computers could imagine. However, in some ways, the users of these modern web applications share commonalities with early programmers.

If you use a web application (such as Yext), and you want to change its behavior, what do you do? You log into the application in a web browser and press a bunch of buttons and type in a bunch of text fields until the configuration matches what you desire. If you decide you want to go back to how it was before, you have to click all those same buttons and type in all those text fields all over again. If someone else using the same web application has configured their account to perform a function that you also want to perform, you need to have that person write down the instructions so that you can reproduce it in your account. Over 70 years have passed since those early computers, and we’ve gone back to flipping switches and turning dials.

There has to be a better way!

Configuration as Code

There is a better way. And it is called Configuration as Code.

What does that mean? It means storing files that are a representation of how a web application is configured. The files for an account can be edited to change the configuration within it. These files can also be stored in a source repository.

This solves some of the problems mentioned earlier. Want to go back to an earlier version of the configuration? Simply use an earlier version of the files as stored in your repository. Want to implement configuration that someone else has in their account? Simply have them send you the files.

But what does Configuration as Code actually look like? To answer this, let’s look at an example from Yext.

Say I created a number field in my Yext account called Price. I can create it in a web browser with the configuration below.

price custom field

Without even knowing it, when I save this, I am also creating a file that represents the configuration. The file is a JSON file, and it looks like this.

{
  "$id": "c_price",
  "$schema": "https://schema.yext.com/config/km/custom-field/v1",
  "displayName": "Price",
  "typeId": "type.decimal",
  "type": {
    "decimalType": {}
  },
  "localization": "PRIMARY_ONLY",
  "group": "NONE"
}

Don’t worry about the specifics of the file. The important thing to note is that there is a file that represents the exact state that I configured in the web browser.

Nearly everything that you can configure in your Yext account has a similar file representing its configuration.

unit Quiz
+20 points
Daily Quiz Streak Daily Quiz Streak: 0
Quiz Accuracy Streak Quiz Accuracy Streak: 0
    Error Success Question 1 of 3

    Which of the following is not a benefit of Configuration as Code?

    Error Success Question 2 of 3

    True or False: The configuration of items in a Yext account are also stored as JSON files.

    Error Success Question 3 of 3

    True or False: Configuration as Code is only meant for reading the configuration of an account and not for editing it.

    Wahoo - you did it! 🙌

    You've already completed this quiz, so you can't earn more points.You completed this quiz in 1 attempt and earned 0 points! Feel free to review your answers and move on when you're ready.
1st attempt
0 incorrect
Splash Loading