---
title: "ASP.NET Core configuration system: Isn&#8217;t the default configuration prone to naming conflicts in environment variables?"
description: "I'm trying to wrap my head around the ASP.NET Core Configuration system. If I understand the default configuration correctly, non-prefixed environment variables will override appsettings.json..."
url: https://extraproxies.com/asp-net-core-configuration-system-isnt-the-default-configuration-prone-to-naming-conflicts-in-environment-variables
date: 2024-01-18
modified: 2024-01-18
author: "ExtraProxies"
tags: ["ASP.NET", "configuration", "conflicts", "Core", "default", "environment", "Isn't", "naming", "prone", "system", "variables"]
type: post
lang: en
---

# ASP.NET Core configuration system: Isn&#8217;t the default configuration prone to naming conflicts in environment variables?

I’m trying to wrap my head around the ASP.NET Core Configuration system.

If I understand the default configuration correctly, non-prefixed environment variables will override `appsettings.json` entries.

For example, if

1. I have an appSettings.json file like this ``` { "SmtpServer": "myserver.example.com" } ```
2. and *some other, completely unrelated application* running on the same server happens to (globally) set an environment variable called `SmtpServer` to `someotherserver.example.com`

that environment variable will override my application configuration.

Now, obviously, I could work around this by (1) prefixing all my settings with the name of my app (which will create a lot of noise in my appsettings.json) or (2) use my own WebApplicationBuilder (2a) to override to default priority order or (2b) to only include environment variables with a specific prefix or (3) blame the other application for setting a global environment variable with such a generic name.

Still, the ASP.NET Core designers are smart people, and if they implement default values, they usually have a very good reason for doing so.

What am I missing? Did I find a flaw in the ASP.NET Core Configuration system default configuration , or is this, for some reason, not a problem in real-life systems? If the latter, what is that reason?
