private static bool EvaluateEnvironmentBasedFeatureState(IFeatureBitDefinition bitDef) { bool featureState; var env = SystemContext.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")?.ToUpperInvariant(); var environmentAry = bitDef.ExcludedEnvironments.ToUpperInvariant().Split(','); featureState = !environmentAry.Contains(env); return(featureState); }
private static bool EvaluateEnvironmentBasedFeatureState(IFeatureBitDefinition bitDef) { bool featureState; var env = SystemContext.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")?.ToUpperInvariant(); var excludedEnvironmentAry = GetEnvironmentList(bitDef.ExcludedEnvironments); var includedEnvironmentAry = GetEnvironmentList(bitDef.IncludedEnvironments); if (includedEnvironmentAry.Any()) { featureState = includedEnvironmentAry.Contains(env); } else { featureState = !excludedEnvironmentAry.Contains(env); } return(featureState); }