Today, I and my colleague had a difference of opinion regarding the usage of default values in software configuration. We both agreed that for a consumer software, the default configuration should be determined by the most common usage and user experience.
However, the contention is in the usage of default values for enterprise-like deployed services where there are multiple deployment environments (production, dev, stage, etc). Think of default API hosts, endpoints, paths, constants, etc. as configuration variables. My opinion is that default values should be something which makes the most sense for production customers. Please note that this doesn't include authentication/sensitive credentials, certificates, etc as developers shouldn't have direct access to such production parameters.
Pros:
- Makes the job of TechOps easier. They rely on convention over configuration paradigm. TechOps can strictly focus on infrastructure and not application specific settings.
- A developer's environment tries to mimic a production environment. A developer easily knows what the values of specific settings will be, for most (if not all) production customers. He/she needs to look up the source and not have to
ssh
customer setups.
Cons:
- More often than not, developer's environment is not compatible with production because not every component is set up by each developer nor is every developer concerned about every component. It becomes developer's responsibility to set their configuration accordingly.
- It leads to writing defensive code which would otherwise never be needed for production scenarios. For example, in our case for a dev setup, an HTTP connection is retried because of default configuration and then given up after receiving a 404. In production setup, TechOps would have ensured the availability and correct endpoint.
A fair compromise, IMO, is to setup different default configurations for each environment and use scripts to deploy them. However, this isn't how our software is designed at the moment.
In today's age of CICD, (using docker, for example) how relevant is the convention over configuration paradigm. What are some preferred approaches to select such defaults?
EDIT: Interesting read is Default values - are they good or evil? which is similar but questions the existence of defaults, which isn't exactly the same.
EDIT2: For those considering downvoting, please consider leaving a comment on what should be improved or is wrong with the question. It'll be helpful for newcomers like me on this SE.