Skip to content
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

Support for ASP.NET Core appsettings.json ? #1

Closed
Inrego opened this issue Aug 23, 2016 · 2 comments
Closed

Support for ASP.NET Core appsettings.json ? #1

Inrego opened this issue Aug 23, 2016 · 2 comments
Assignees

Comments

@Inrego
Copy link

Inrego commented Aug 23, 2016

Hello. Does this currently (or is it planned to) support the new configurations for ASP.NET Core 1.0?

There doesn't seem to be a schema, but there is a .json file available with the currently configured settings. Here's an example:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Ditra.Web-429f8d2d-971a-4358-94fd-e3d762039c60;Trusted_Connection=True;MultipleActiveResultSets=true"
  },
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
}

Getting an instance of the configuration is done like this:

var builder = new ConfigurationBuilder()
    .SetBasePath(env.ContentRootPath)
    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
var configuration = builder.Build();
var sytemLogLevel = configuration["Logging:System"];

Would be great to have intellisense on the last line of above example to type out "Logging:System".
One can also add user secrets to the builder, which is basically just include a json file stored somewhere else on the system, specific for the project ID. You can read more about that here: https://docs.asp.net/en/latest/security/app-secrets.html

To begin with, it would be great to just have intellisense for the properties configured appsettings.json
If you can include other sources, I guess that would be useful too, but maybe another milestone.

@olsh olsh self-assigned this Aug 23, 2016
@olsh
Copy link
Owner

olsh commented Aug 23, 2016

@Inrego thanks for the suggestion.
I haven't used ASP.NET Core yet, but I think this is a must have feature.

I'll try to implement it when there will be spare time.

olsh added a commit that referenced this issue Sep 5, 2016
olsh added a commit that referenced this issue Sep 6, 2016
@olsh
Copy link
Owner

olsh commented Sep 6, 2016

Implemented in 2016.2.1.

@olsh olsh closed this as completed Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants