I'm working with feature flags using Azure App Configuration and I'm trying to decide whether to include default states for these flags in my code. In my previous projects, we didn't use defaults, but now that I'm setting things up myself, I'm questioning that approach. On one hand, Azure's paid service claims to have about 99% uptime, which makes it seem unnecessary to add complexity for rare outages. However, without defaults, our application could behave unpredictably if the service goes down, which would lead to a poor user experience. I'm specifically considering simple true/false flag values without rollout strategies or variants. How do other developers handle default states in feature flags? Thanks for your input!
1 Answer
Definitely always include defaults in your code. Even with Azure’s 99% uptime guarantee, you're looking at around 3.5 days of potential downtime in a year. Not to mention, you can encounter network glitches or random errors, so having defaults is a smart move. I usually initialize my feature flags like this:
```javascript
const featureFlags = {
newFeature: getFlag('newFeature') ?? false,
experimentalUI: getFlag('experimentalUI') ?? false
}
```
For risky features, I’d default to false to avoid any issues. Plus, it makes local development smoother since you can run the app without needing Azure up and running—everything just works with sensible defaults.

What’s the getFlag function do in your setup?