private static void LoadConfiguration()

in src/Relecloud.Web.CallCenter.Api/Infrastructure/IntermittentErrorRequestMiddleware.cs [44:59]


    private static void LoadConfiguration(HttpContext context)
    {
        var config = context.RequestServices.GetService<IConfiguration>();
        if (config != null)
        {
            if (!string.IsNullOrEmpty(config["Api:App:RetryDemo"]))
            {
                if (int.TryParse(config["Api:App:RetryDemo"], out int newErrorRate))
                {
                    // When set to 1 this simulation will return an error every other request
                    // When set to 2 this simulation will return two errors between successful requests
                    _backToBackExceptionCount = newErrorRate;
                }
            }
        }
    }