Don't put default values in configuration files

2019/01/04

Configuration (config) files are common in any advanced piece of software. Databases, proxies, you name it, if it has any kind of complexity it probably has a file you can open and tweak various values. What you should not do, however, is put default values in your config file.

For example, let’s say your config file has this value.

log-enabled = true

Great. Logging is enabled. But what is the software’s default behavior? Does the software still log if that line was removed from the config file? If so then that is a default value and should not be in a production config file.

If you want to leave default values in while you are learning the software or just trying to understand it better then that’s great. If you are in production, however, then you really want to show what you have modified. When things are broken every variable counts.

One thing to remember: occasionally a piece of software needs every value to be in the config file. If that is the case then you have no choice but to leave all the default values in there.