FlagProvider
FlagProvider
Interface for external feature flag providers. Implement this interface to integrate with external flag management systems like LaunchDarkly, Split, Unleash, etc.
Signature
interface FlagProvider {
initialize?(): MaybePromise<void>;
getFlag(key: string, context?: any): MaybePromise<FlagConfiguration | null>;
hasFlag(key: string): MaybePromise<boolean>;
destroy?(): MaybePromise<void>;
}
initialize
method
() => MaybePromise<void>
Initialize the provider (e.g., establish connections, load initial config)
getFlag
method
(key: string, context?: any) => MaybePromise<FlagConfiguration | null>
Get the current value/configuration for a feature flag
hasFlag
method
(key: string) => MaybePromise<boolean>
Check if a flag exists in the external system
destroy
method
() => MaybePromise<void>
Cleanup resources when the provider is no longer needed