Steeltoe icon indicating copy to clipboard operation
Steeltoe copied to clipboard

The service credentials from cloud foundry environment is not taken over. Always taking the redis client credentials from the appsettings.json

Open senthanal opened this issue 3 years ago • 1 comments

Question 1

The service credentials from cloud foundry environment is not taken over. Always taking the redis client credentials from the appsettings.json.

Environment

  • .NET6 Version
  • Steeltoe Version 3.2.2
  • Packages used "Steeltoe.Connector.CloudFoundry": "3.2.2", "Steeltoe.Connector.ConnectorCore": "3.2.2", "StackExchange.Redis": "2.6.70",

Additional context or links

Added service configuration as mentioned below: using Steeltoe.Connector.Redis; using StackExchange.Redis; // Add StackExchange IConnectionMultiplexer services.AddRedisConnectionMultiplexer(Configuration); services.AddScoped(s => s.GetService().GetDatabase());

Question 2

When I add the following code in Program.cs to inject cloud foundry configuration

using Steeltoe.Extensions.Configuration.CloudFoundry; var builder = WebApplication.CreateBuilder(args); builder.Configuration.AddEnvironmentVariables().AddCloudFoundry();

I get the Object reference not set to an instance of an object error

The error thrown at this line services.AddScoped(s => s.GetService().GetDatabase()); The GetService call fails.

Seems cloud foundry VCAP_SERVICES and VCAP_APPLICATION environment variables configuration is not taken over by the steeltoe redis connector. How do I fix the issue?

Any help would be great. Thank in advance!!

senthanal avatar Feb 03 '23 22:02 senthanal

Firstly, sorry we've not responded to this issue sooner, we've had a lot happening behind the scenes.

Are you able to provide a more complete repro and/or have you looked at the Redis connector sample to test if it works in your environment and look for code differences?

TimHess avatar Mar 01 '23 23:03 TimHess