rollbar / Rollbar.NET

Rollbar for .NET
https://docs.rollbar.com/docs/dotnet
MIT License
65 stars 44 forks source link

ASPNET Core Configuration Hierarchy not respected. #516

Open VictorioBerra opened 4 years ago

VictorioBerra commented 4 years ago

Describe the bug If you have your access token in a secrets file for example, this will not get loaded. Same with environment vars, CLI args, etc.

https://github.com/rollbar/Rollbar.NET/blob/master/Rollbar/NetCore/AppSettingsUtility.cs#L181

To Reproduce Create a secrets file. Put { "Rollbar": { "AccessToken": "abc1234"}}. Examine RollbarLocator.RollbarInstance.Config.AccessToken notice its not the one from secrets.

Expected behavior Get the config setting from configuration and let ASPNET Core decide where to look

akornich commented 4 years ago

@VictorioBerra , correct, currently, we are only supporting loading configuration either via appsettings.json, or app.config, or any other similarly-formatted file (either JSON or XML based using dedicated Rollbar section): https://docs.rollbar.com/docs/logger-configuration.

It is not really a bug but a scenario we never considered to support yet.

We may consider supporting this scenario but, first, we would like to learn what is the motivation for it. The access token is stored on a server under your control. The token does appear in the web requests posting the payload so it is not an absolute secret on the big scale.

JohnCampionJr commented 3 years ago

I agree this is a bug.

Rollbar should follow Core standards with regards to reading the appsettings.json file.

For example, I have basic config in appsettings.json with production values in appsettings.Production.json.

Rollbar does not use the values in Production.