-
Notifications
You must be signed in to change notification settings - Fork 25.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration coverage #7102
Comments
Consider not focusing on ASP.NET Core and ensure the docs are applicable (or understood to be applicable) to any .NET Core app that wants config. I suspect there are people who see a lot of ASP.NET references, think, "Not applicable, I'm writing for Xamarin" (or whatever), and stop reading. |
Thanks for your feedback @tillig. We'll look at this subject in more detail shortly. I have a few other issues to attend first. Great job on your post. You beat us (me) to it! We've been crazy busy. 🏃 Our priority before reaching this issue is on-going 2.1 updates (e.g., samples). There's a light at the end of the tunnel tho. 🚂 😅 |
That would be a great statement to say upfront. |
@Rick-Anderson @scottaddie @Tratcher I've updated the OP ☝️. This is ready for a look/discussion. Comments? .... Concerns? |
I agree that configuring a wep app is different from the Configuration APIs, but lumping them together under a Configuration topic seems like a recipe for confusion. Do we need two top level categories "Configuring Web Apps" and "Configuration APIs"? Hmm, not sure that's better... |
I propose to do this in a section of the landing topic. I don't plan to provide details there. I'd link out and down to the specifics.
I propose to do what you said, but I recommend that we do it in a section early in the Configuration landing page. We can link out and down from there. Today, the subject of host vs. app config is MIA early in the docs. We leave it up to the dev to piece together what's going on after they're read the "configuration" topic and the "Web Host/Generic Host" topics. A landing page that calls out the basics (and links the content) should solve this problem. Additionally, we should consider moving the Host node earlier in the TOC. Host is an HORRIBAD position imo. To me, it falls into an early app build/maintain concern. Why do we have it after ...
|
It seems like the config APIs warrant there own top level landing page for non-asp.net folks. Referencing that from your other landing page is fine. |
[EDIT] Didn't work to have host vs app config in the Fundamentals landing page. It's buried there. I'll try including a section in the Configuration topic itself.
|
Sure, nothing wrong with moving Host up. |
@Tratcher It appears that switch mappings are incompatible with There's no way to add a switch mapping dictionary to the It seems the only way to do it is to not use No 🎲🎲... public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
var switchMappings = new Dictionary<string, string>
{
{ "-CommandLineKey1", "CommandLineKey1" },
{ "-CommandLineKey2", "CommandLineKey2" }
};
var config = new ConfigurationBuilder()
.AddCommandLine(args, switchMappings)
.Build();
return WebHost.CreateDefaultBuilder(args)
.UseConfiguration(config)
.UseStartup<Startup>();
} This works ... public static void Main(string[] args)
{
var switchMappings = new Dictionary<string, string>
{
{ "-CommandLineKey1", "CommandLineKey1" },
{ "-CommandLineKey2", "CommandLineKey2" }
};
var config = new ConfigurationBuilder()
.AddCommandLine(args, switchMappings)
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseStartup<Startup>()
.Start();
using (host)
{
Console.ReadLine();
}
} |
That should work... Are you confusing it by passing in args twice? What if you remove args from CreateDefaultBuilder(args)? |
@Tratcher The ConfigurationBinder doesn't seem to be able to bind recurring element contents (section2 > items below). It chokes saying that the items create duplicate keys in the configuration (i.e., it doesn't use the <top_level>
<section0>
<item0>section0-item0-value</item0>
<item1>section0-item1-value</item1>
</section0>
<section1>
<items>
<item id="item0">section1-items-item0-value</item>
<item id="item1">section1-items-item1-value</item>
<item id="item2">section1-items-item2-value</item>
</items>
</section1>
</top_level> Is there a way, or is it just not capable of binding this scenario? |
@guardrex Use |
Thanks @tillig! |
Goals
Most of the coverage in @tillig's post Deep Dive into Microsoft Configuration is present in the docs. We'll improve organization and content quality on this pass. I'll react to @tillig's comment below to ensure the docs are applicable (or understood to be applicable) to any .NET Core app that wants config.
Suggestions
IConfiguration
). However in many cases, the content might be passing mentions and not worth linking. If there are some opportunities here, then list and link out to those scenarios.IOptions<IISOptions>
). Link out to the Options topic for details.IOptions
used by the framework with links out to those scenarios.Questions
Prior work
Advance PRs to simplify the workload for this issue:
I resolve Document overriding app settings in Azure Portal #6514 in the PR.
Syntax highlighting missing string interpolation #7207 was moved to the DocFX repo issues. It's out-of-scope for us.
The text was updated successfully, but these errors were encountered: