Architektura Pokročilý
Feature Flags implementace¶
Feature FlagsDeploymentRelease 3 min čtení
Postupný rollout nových funkcí. Kill switches, percentage rollout a A/B testing.
Typy¶
- Release Toggle — postupný rollout (10% → 50% → 100%)
- Experiment — A/B testing
- Ops Toggle — kill switch
- Permission — funkce pro specifické plány
Implementace¶
class FeatureFlags {
isEnabled(flag, ctx = {}) {
const f = this.flags[flag];
if (!f?.enabled) return false;
if (f.percentage !== undefined) {
return (this.hash(ctx.userId) % 100) < f.percentage;
}
if (f.allowedUsers?.includes(ctx.userId)) return true;
return f.enabled;
}
}
// Konfigurace
const flags = new FeatureFlags({
newCheckout: { enabled: true, percentage: 25 },
darkMode: { enabled: true }
});
Nástroje¶
- LaunchDarkly — enterprise
- Unleash — open-source
- Flagsmith — open-source + cloud
Shrnutí¶
Must-have pro continuous delivery. Udržujte disciplínu — pravidelně odstraňujte staré flags.
Potřebujete pomoct s implementací?¶
Náš tým má zkušenosti s návrhem a implementací moderních architektur. Rádi vám pomůžeme.