public ShopController(IConfiguration configuration, IFeatureFlag feature, IMemoryCache cache, IEventBus eventBus) { _configuration = configuration; _feature = feature; _cache = cache; _eventBus = eventBus; }
public async Task ExampleUsage1() { // Get your key from https://console.developers.google.com/apis/credentials var apiKey = "AIzaSyCtcFQMgRIUHhSuXggm4BtXT4eZvUrBWN0"; // https://docs.google.com/spreadsheets/d/1KBamVmgEUX-fyogMJ48TT6h2kAMKyWU1uBL5skCGRBM contains the sheetId: var sheetId = "1KBamVmgEUX-fyogMJ48TT6h2kAMKyWU1uBL5skCGRBM"; var sheetName = "MySheet1"; // Has to match the sheet name var googleSheetsStore = new GoogleSheetsKeyValueStore(new InMemoryKeyValueStore(), apiKey, sheetId, sheetName); var testStore = new FeatureFlagStore(new InMemoryKeyValueStore(), googleSheetsStore); IoC.inject.SetSingleton <FeatureFlagManager <FeatureFlag> >(new FeatureFlagManager <FeatureFlag>(testStore)); // Open https://docs.google.com/spreadsheets/d/1KBamVmgEUX-fyogMJ48TT6h2kAMKyWU1uBL5skCGRBM for these: Assert.False(await FeatureFlag.IsEnabled("MyFlag1")); Assert.True(await FeatureFlag.IsEnabled("MyFlag2")); var key3 = "MyFlag3"; IFeatureFlag flag3 = await FeatureFlagManager <FeatureFlag> .instance.GetFeatureFlag(key3); Assert.Equal(40, flag3.rolloutPercentage); // Rollout of feature 3 is at 40% // The local random value that was chosen determines if the flag is enabled or not: if (flag3.localState.randomPercentage <= flag3.rolloutPercentage) { Assert.True(await FeatureFlag.IsEnabled(key3)); } else { Assert.False(await FeatureFlag.IsEnabled(key3)); } }
public FeatureFlagController(IFeatureFlag featureFlag) { _featureFlag = featureFlag; }
private bool LastCachedIsFeatureUnlocked(IFeatureFlag featureFlag) { return(featureFlag.requiredXp <= GetLastCachedXp()); }
public static bool IsActive(this IFeatureFlag feature, FeatureContext context) { return(feature.GetState(context) == FeatureFlagState.Active); }
public static bool IsActive(this IFeatureFlag feature) { return(feature.GetState(null) == FeatureFlagState.Active); }
/// <summary> /// Constructor /// </summary> /// <param name="roles">Roles to check.</param> /// <param name="featureFlags">Optional Feature Flag service.</param> public RoleRequirementFilter(string[] roles, IFeatureFlag featureFlags = null) { _roles = roles; _featureFlags = featureFlags; }
public ShopControllerV1(IConfiguration configuration, IFeatureFlag feature) { _configuration = configuration; _feature = feature; }