--- title: > Introducing feature flags to "build-configs" pubDate: 2023-04-17 permalink: >- archive/2023/04/17/introducing-feature-flags-to-build-configs tags: [] --- Yesterday, I wanted to make a breaking change to my [build-configs project]({{site.url}}/archive/2023/03/04/why-i-built-a-tool-to-generate-configuration-files) - changing the default database credentials that are used by Docker Compose. As I have several projects based on generated files by the tool, changing the values could cause issues in those projects in the future and this is something that I wanted to avoid. ## What did I do? To avoid this issue and needing to update all of my projects at once, I added a feature flag to the `build.yaml` file so I can opt-in to this feature on a per-project basis. If a project, like my [Drupal](https://github.com/opdavies/docker-example-drupal) and [LocalGov Drupal](https://github.com/opdavies/docker-example-drupal-localgov) Docker examples, are opted in, its files will get the new credentials. If not, it will continue to use the original ones. [In this commit](https://github.com/opdavies/docker-example-drupal/commit/3f496168d5c32f9706970519023b431ee02c4b19), you'll see where I enabled the feature flag and committed the resulting change. ## What does this achieve? I can continue to work on existing projects without them breaking, and migrate projects one at a time by using the feature flag instead of needing to do them all once. Once all active projects have been migrated or completed, the feature flag can be removed and I can refactor and simplify the code - removing the feature flag and the legacy values.