Why I built a tool to generate configuration files

I’m always working on various personal and client projects, and they contain a lot of the same configuration files. I exclusively use Docker and Docker Compose on all projects, I use a justfile for running tasks, and for PHP projects, I need configuration files for tools like PHPStan, PHPCS and PHPUnit.

The majority of those files are the same with some slight configuration for each project - such as whether it uses web or docroot, or which paths are checked with static analysis or for coding standards issues.

I’ve given a talk called Working with Workspace - a tool that we used at an agency I worked at. It had two functions - to execute project tasks and to generate configuration files from templates.

I use a justfile to execute tasks and commands but needed to write my own tool to generate the configuration files.

The result is that I can add one YAML file to a project, enter the values that it needs and when I run the CLI tool, it will generate all of the files the project needs.

As well as being faster to set up a project, like a LocalGov Drupal Docker example, having a canonical set of templated configuration files I can enhance and maintain by adding new features and fixes and they’ll be added to every project when I next generate its files.