Config vs Setting vs Feature flag
Config
Config needs restart to be updated, static, stored in file, override by env variable, small number of config
Example: DB config, server listen port, remote host location
Feature flag
Feature flag and settings can be changed at runtime without restart or down time. Both are similar but I want to draw a bold line separate them.
Feature flag is temporary, has to be clean up or removed someday in the future. It is about roll out, release, use context to decide who, when, where, which version to enable which can be apply to users partially, or globally. It is usually controlled by engineers, or technical operation team.
Setting
Setting is permanently. It has been designed to be in the code without creating technical debt.
It likes a feature which has a real user use case for example to adjust behavior of the system.
It should be safe to be uses, changes, enables, disables in numerous times. It should be test throughout.
Any feature flags that has been rolled out and stable, can be transitioned to setting such as kill switch.
Example: Site title, User role & Permission, Look & feel, Content to be shown
Below is a comparison table:
Config | Feature flag | Setting | |
---|---|---|---|
When to changes | Before start | Runtime | Runtime |
Lifetime | Temporary/Permanently | Temporary | Risky, moderate tested |
Safety | Very safe, well tested | Permanently | Safe, well tested |
User | Engineer/Operator | Engineer/Operator | Normal user |
Affects | Global/All users | Partial/Global | Global/Depends on each feature |
Tech Debt | Low | High | Medium |
Amount of configurable | Low | High | Medium |
Rate of changes | Rarely | Occationally | On demand |