What if you could change your app's behavior instantly without touching its code or restarting it?
Why externalized config enables flexibility in Microservices - The Real Reasons
Imagine you have many small apps (microservices) running on different servers. Each app needs settings like database info or feature flags. If you change these settings, you must update each app's code or restart them one by one.
This manual way is slow and risky. You might forget to update some apps, causing errors. Restarting apps often breaks service for users. It's hard to keep track of all settings scattered inside code or config files.
Externalized config means keeping all settings outside the apps, in one place. Apps read their settings from this central store when they start or even while running. This way, you can change settings anytime without touching app code or restarting services.
const dbHost = 'localhost'; // hardcoded in app // Need to redeploy app to change
const dbHost = configService.get('db.host');
// Change config anytime without redeployIt lets you update app settings instantly and safely, making your system flexible and easier to manage.
A shopping website uses externalized config to turn on holiday sale features only during the season, without stopping the site or changing code.
Manual config inside apps is slow and error-prone.
Externalized config centralizes settings for easy updates.
This approach improves flexibility and uptime in microservices.