I am not sure what impact this might have on upgrades, so its worth making sure you check when you do upgrade, but in general you can make changes to these files between major versions with no issues (and usually major versions too).
Just thought I'd add how I achieve something similar on my projects.
I use the "User Secrets" functionality in Visual Studio.
Any app settings added here will override whatever is in your appsettings.{configuration}.json
The secrets.json that's created is stored at C:\Users\[username]\AppData\Roaming\Microsoft\UserSecrets\[guid] so it is separate from your local repo.
I know it's not exactly what you asked for, but it's a good way of using different app settings without worrying about accidentally committing them to your repository.
appsettings.{Environment.MachineName}.json
Does anyone know how to get this working in umbraco? I found some generic .net core instructions but not for Umbraco9+
I want appsettings.my-machine-name.json just for me so can have custom path & connection strings that differ from the other devs in my team.
I found this: https://andrewlock.net/how-to-use-machine-specific-configuration-with-asp-net-core/
But umbraco seems to differ from that pattern of startup.cs
Hi,
yes by default Umbraco is using the default settings here, so looking for command line, envrionmental variables and then the files.
you can add the machine one if you want in program.cs
adding
seems to work, this would then be after the ConfigureUmbracoDefaults() section For example:
I am not sure what impact this might have on upgrades, so its worth making sure you check when you do upgrade, but in general you can make changes to these files between major versions with no issues (and usually major versions too).
Awesome I knew it was possible, I just couldn't find the right spot. Cheers.
Just thought I'd add how I achieve something similar on my projects.
I use the "User Secrets" functionality in Visual Studio. Any app settings added here will override whatever is in your appsettings.{configuration}.json
The secrets.json that's created is stored at
C:\Users\[username]\AppData\Roaming\Microsoft\UserSecrets\[guid]
so it is separate from your local repo.I know it's not exactly what you asked for, but it's a good way of using different app settings without worrying about accidentally committing them to your repository.
That looks handy too, Thanks Owain
Hi Owain I tried this and it appears that the order of over-ride is like so: Which is ok, I was just expecting the last 2 in the other order :-)
appsettings.json
appsettings.Development.json
secrets.json
appsettings.{Environment.MachineName}.json
Huh, interesting, I would've expected it to be the other way around too!
is working on a reply...