Consistency is key

A side effect of using a tool to generate build configuration files with templates is the consistency that it introduces.

The majority of my projects use a PHP-FPM or PHP CLI container. In my Docker Compose file, the service was mostly named php but sometimes it was php-fpm. In the templated file, it's always named php.

Some projects would use mysql or mariadb for the database service and nginx or caddy depending on which server was being used. These are now always database and web respectively.

As well as being easier to switch between projects and not having to think about which names are used in each codebase, it's also much easier to write tools and automation when the names are consistent.

For example, I'd always write a long-ish command to import a database file - reading and unzipping it, and importing it by connecting to the database running in its container. The command would essentially be the same with slight changes based on that project - such as the database service name.

Now the command is the same for all projects, and I can automate it by writing a script that works on any project meaning I no longer need to write the long command at all.