public static async Task <TweekIdentityProvider> Create(IRulesRepository repository)
        {
            var allRules = await repository.GetAllRules();

            var initialIdentities = ExtractIdentitiesWithAuth(allRules.Keys);

            return(new TweekIdentityProvider(repository, initialIdentities));
        }
Example #2
0
        public static async Task <Func <(GetRule, PathExpander)> > Factory(IRulesRepository repository, GetRuleParser parserResolver)
        {
            (GetRule, PathExpander)? instance = null;
            repository.OnRulesChange         += (newRules) => instance = Parse(newRules, parserResolver);
            var initRepo = Parse(await repository.GetAllRules(), parserResolver);

            instance = instance ?? initRepo;
            return(() => instance.Value);
        }
Example #3
0
        public static async Task <Func <(GetRule, PathExpander)> > Factory(IRulesRepository repository, GetRuleParser parserResolver)
        {
            var instance = Parse(await repository.GetAllRules(), parserResolver);

            repository.OnRulesChange += (newRules) =>
            {
                using (TraceHelpers.TraceTime("loading new rules"))
                {
                    instance = Parse(newRules, parserResolver);
                }
            };
            return(() => instance);
        }