Azure / Azure/azure-functions-dotnet-worker
Print warning when AddJsonFile is called with "local.settings.json"
- Dominant language
- C#
- Stars
- 466
- Forks
- 215
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 7
Description
Is it possible to somehow warn if someone tries to load local.settings.json like this? Maybe an analyzer?
```cs
public static void Main()
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureAppConfiguration((context, config) =>
{
config.AddJsonFile("local.settings.json", optional: true);
})
.Build();
host.Run();
}
```
There's no reason to do this. Locally, Core Tools already loads the settings from that file into the environment. In Azure, we don't want customers using local.settings.json. They should be using App Settings.
Contributor guide
No contributing guide indexed for this repository
Research direction
No files, tests, or implementation entry points are named. Start by reviewing how ConfigureAppConfiguration and AddJsonFile are handled, then determine whether an analyzer or another warning mechanism fits; done should be a clear warning for loading local.settings.json and guidance toward App Settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- cloud, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100