public LogEngine() { JsonConfigReader configReader = new JsonConfigReader(JsonConfigReader.ConfigFileName); Require.NotNull(configReader, nameof(configReader)); Console.WriteLine("data reading from config file"); var connectionString = configReader.GetConnectionString("ApacheLogs"); _filePath = configReader.GetValue <string>("FilePath"); _accessKey = configReader.GetValue <string>("AccessKey"); _counterForSave = configReader.GetValue <int>("CounterForSave"); _outerIpServiceUrl = configReader.GetValue <string>("OuterIpServiceUrl"); _httpClient = new InnerHttpClient(); Require.NotEmpty(connectionString, () => $"{connectionString} should be specified in the appsettings.json file"); Require.NotNull(_httpClient, nameof(_httpClient)); Require.NotEmpty(_filePath, "'FilePath' should be specified in the appsettings.json file"); Require.NotEmpty(_accessKey, "'AccessKey' should be specified in the appsettings.json file"); Require.NotEmpty(_outerIpServiceUrl, "'OuterIpServiceUrl' should be specified in the appsettings.json file"); Require.IsTrue(_counterForSave > 0, "'CounterForSave' should be specified in the appsettings.json file"); Console.WriteLine("data base connecting"); var optionsBuilder = new DbContextOptionsBuilder <ApacheLogDbContext>(); optionsBuilder.UseSqlServer(connectionString); DbContextOptions <ApacheLogDbContext> options = optionsBuilder.Options; _context = new ApacheLogDbContext(options); Require.NotNull(_context, nameof(_context)); _context.Initialize(); }
public DefaultApiClient(ITokenManager tokenManager, IInnerHttpClient innerHttpClient) { _tokenManager = tokenManager; _innerHttpClient = innerHttpClient; }
public TokenRetriever(IInnerHttpClient innerHttpClient) { _innerHttpClient = innerHttpClient; }
public static Task <string> GetJson(this IInnerHttpClient httpClient, string ip, string outerIpServiceUrl, string accessKey) => httpClient.Execute(string.Format(outerIpServiceUrl, ip, accessKey));