This week I started helping a small startup evaluate and streamline their prototype application. Every time I start one of these projects, I’m struck in the face by how many common anti-patterns I see repeated on practically every project.
Today I want to talk about the over-use of configuration.
Here’s an (anonymized) snippet of the configuration for the application I’m working on (extracted from the docker-compose configuration):
- S3_LOCAL_PATH=./static/
- EMAIL_TEMPLATE=./static/notifications/email.yml
- SMS_TEMPLATE=./static/notifications/email.json
- PUSH_TEMPLATE=./static/notifications/email.json
- FIREBASE_PRIVATE_KEY_PATH=./firebase.json
- PUSH_NOTIFICATIONS_PATH=./static/notifications/push/push.json
This is just silly.
Literally none of these variables should exist.
Why?
This application is executed in one of two modes:
- From a Docker container
- In the local development path
Providing file paths to programs that execute from within Docker is almost by definition redundant. The whole idea of Docker is to package a complete application.
And in many cases, such as this one, development needs are no different. If there were some need to specify an alternate path, it would probably be enough to have a single configuration variable pointing to the top-level path.
Needless to say, I’ll be ripping out these configuration variables and replacing them with constants. This will reduce complexity both in the program itself, as well as in the configuration and depoyment. Win-win for Dev and Ops!
Top comments (3)
Good one,
Jonathan you mentioned anti-patterns. Do you know any good resource to have these anti-patterns and false designed in system architecture / Kubernetes / deployment / etc ... to check?
That's a good question. I've written about many of them in the past. A few examples, not specifically about configuration:
It's also a topic that comes up a lot on my daily mailing list: jhall.io/daily/
I'll also probably be writing a list of common configuration-related antipatterns soon, which will be even more closely related to the topic of this post.
Oh man, We have a similar discussion in our team regarding having automated deployment. I really liked NOCD thing :D