public void ConfigureServices(IServiceCollection services) { services.AddMvc(); // works with VCAP_SERVICES JSON value added to config.json when running locally, // and works with actual VCAP_SERVICES env var based on configuration set above when running in CF var creds = new CloudantDotNet.Models.Creds() { username = Configuration["cloudantNoSQLDB:0:credentials:username"], password = Configuration["cloudantNoSQLDB:0:credentials:password"], host = Configuration["cloudantNoSQLDB:0:credentials:host"] }; services.AddSingleton(typeof(CloudantDotNet.Models.Creds), creds); services.AddTransient<ICloudantService, CloudantService>(); }
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); // works with VCAP_SERVICES JSON value added to config.json when running locally, // and works with actual VCAP_SERVICES env var based on configuration set above when running in CF var creds = new CloudantDotNet.Models.Creds() { username = Configuration["cloudantNoSQLDB:0:credentials:username"], password = Configuration["cloudantNoSQLDB:0:credentials:password"], host = Configuration["cloudantNoSQLDB:0:credentials:host"] }; services.AddSingleton(typeof(CloudantDotNet.Models.Creds), creds); services.AddTransient <ICloudantService, CloudantService>(); }
public CloudantService(Creds creds) { _cloudantCreds = creds; }