Steeltoe icon indicating copy to clipboard operation
Steeltoe copied to clipboard

Configuration properties sections are case sensitive

Open thompson-tomo opened this issue 1 year ago • 5 comments

Describe the bug

When i define my app configuration as per https://docs.steeltoe.io/api/v3/discovery/netflix-eureka.html it is not using the values I am supplying via my configuration layer. If i change the sections key to lower case they do correctly resolve.

Steps to reproduce

Steps to reproduce the behavior:

  1. Have a configuration provider generate config as per below Data.Add("Eureka:Instance:InstanceId", $"192.168.1.1:90");
  2. Run the application register with a eureka instance
  3. Observe that the instanceid received is "localhost:{{appName}}:{{port}}"
  4. Change configuration key to be Data.Add("eureka:instance:InstanceId", $"192.168.1.1:90");
  5. Observe instanceid is now set correctly

Expected behavior

The configuration parameters are not case sensitive

Environment (please complete the following information):

  • Steeltoe Version 3.2.6
  • OS: Windows
  • .NET Version Net 8

thompson-tomo avatar May 12 '24 10:05 thompson-tomo

I suspect there's something wrong with your app configuration layer, or it executes too late. I'm unable to reproduce this against Steeltoe 3.x. I've tried the following:

  1. Open https://github.com/SteeltoeOSS/Samples/blob/main/Discovery/src/FortuneTeller.sln, set Fortune-Teller-Service as startup project
  2. Add the following line to Program.cs, between .AddCloudFoundryConfiguration() and .AddAllActuators():
    ConfigureAppConfiguration(builder => builder.AddInMemoryCollection(new Dictionary<string, string>
    {
        { "Eureka:Instance:InstanceId", "some" }
    }))
    
  3. Start Eureka docker container
  4. Select the Fortune-Teller-Service launch profile, run the project, and navigate to http://localhost:8761/eureka/apps
  5. The registered app shows up with Instance ID "some", see below: image

Can you provide reproduction steps, so it can be reproduced and debugged?

bart-vmware avatar May 13 '24 08:05 bart-vmware

i know that it is not an issue with config layer ordering as if I change the casing it correctly resolves it.

Would it be helpful if I make a basic repo branch rather than try an describe it?

thompson-tomo avatar May 13 '24 10:05 thompson-tomo

I would prefer if you try to reproduce the problem with our sample, gradually adding parts from your app until it breaks.

bart-vmware avatar May 13 '24 11:05 bart-vmware

Sure thing will do that

thompson-tomo avatar May 13 '24 12:05 thompson-tomo

hmm, this is interesting. I have brought across my entire configuration layer and can't reproduce it. Changing the casing still results in it working. Maybe some serialisation behaviour differs? But will need to look into this further.

thompson-tomo avatar May 13 '24 22:05 thompson-tomo

Thanks for investigating. I'm closing this, as it doesn't seem to be a Steeltoe issue. Feel free to open a new issue when you've identified what's going on.

bart-vmware avatar May 14 '24 06:05 bart-vmware