// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <DbSetting>(Configuration.GetSection(nameof(DbSetting))); services.AddSingleton <IDbSetting>(sp => sp.GetRequiredService <IOptions <DbSetting> >().Value); string cashHost = Environment.GetEnvironmentVariable("CASH_HOST"); if (String.IsNullOrEmpty(cashHost)) { Console.WriteLine("Host for cash isn't configurated"); } string cashPort = Environment.GetEnvironmentVariable("CASH_PORT"); if (String.IsNullOrEmpty(cashPort)) { Console.WriteLine("Port for cash isn't configurated"); } var cash = new RedisDbConnector(cashHost, cashPort); services.AddSingleton <ICashConnector>(cash); //services.AddSingleton<ICashConnector, RedisDbConnector>(); services.AddSingleton <ICountryLoader, HttpCountryLoader>(); services.AddSingleton <ICountryProxyService, CountryProxyService>(); services.AddCors(options => { options.AddDefaultPolicy( builder => { builder.WithOrigins("http://localhost:3000"); }); }); services.AddControllers(); }
public JoinedParticipantsRepository_RemoveParticipant_Redis(RedisDbConnector connector) : base( KeyValueDatabaseFactory.Create(connector.CreateConnection())) { }