New feature with config
Faizan Khan
Senior PHP Developer | Symfony Expert | Microservices | NestJS | OpenAI | AWS | Docker | GIT
Using config switch is a way to switch off or on a feature on a working software during runtime. We can use configuration or condition to achieve this. Config switch is also known as feature flag, feature toggle and conditional feature.
Why do we need config switch?
My first experience with config switch in sellanycar.com, when i had to deploy the feature related to the button on customer dashboard to upload their payment proof against their purchasing.
You can only use this switch config for certain reasons:
- Control the release of a feature: getting your code merged, tested, and deployed into production and only delivering it to your users when you (or your product manager) want(s).
- Speed up development by integrating incomplete features.
- Allow releasing when a new feature is not yet ready.
- Enable to derisk releases using gradual feature rollout.
- Enable roll back when production issue found in feature
Example Code
isFeatureOn config can be setting in the database or part of .env file. if (isFeatureOn) { // give access to something } else { // prevent access to something }
Turn it off
So let's assume, that you tested your feature intensively on your production environment and you didn't get any complaint from customer once you are satisfied you just remove the condition and deploy again. Switch feature cleanup is also required for clean code.
Conclusion
Stop making big tasks/tickets that take weeks to complete. Apply feature switch and deploy small things. Don't afraid to test them on production and switch off if there is any breaking change.
Senior PHP Developer | Symfony Expert | Microservices | NestJS | OpenAI | AWS | Docker | GIT
4 å¹´Umair Mumtaz We need to clean up some config which doesn't require as per the best practises. :-D