Specify Environment Appsettings.JSON

Hi All,
Sorry if this has been answered somewhere, but I couldn’t find it. I’m working with a C# .Net 5 application and I’d like to set the Environment via Appsettings.json but can’t find if that is possible.

If you’re using Sentry.AspNetCore it will load the configuration values from appsettings.json automatically.

I use this on NuGet Trends:

.NET’s configuration system also support setting it via environment variable, with the same path as the json keys, like: export Sentry__Debug=true would be also picked up.

Sentry has examples for that here; examples/appsettings.json at d6dffafd7308962e91ed043bf6b78065fc7138ce · getsentry/examples · GitHub