liveBook · Manning

JSON file provider

As explained in .NET in Action, Second Edition

A JSON configuration provider is a .NET configuration component that loads settings from a JSON file.

A JSON file provider adds a JSON file as a configuration source. It can supply secrets or other settings, including values mounted into a container. section 13.5

The focused implementation relies on:

  • A JSON structure matching appsettings.json, allowing settings such as CosmosDbSettings:AuthKey. section 13.5

Mounted secrets file

Mount a host secrets.json file into a separate container settings folder, then register /settings/secrets.json with AddJsonFile. Bind the CosmosDbSettings section to application settings. section 13.5

How .NET in Action, Second Edition covers it

How deep it goes
Shows the AddJsonFile call, optional-file behavior, and section binding, without detailing provider internals.
Examples
Uses secrets.json mounted at /settings/secrets.json and binds the CosmosDbSettings section.
What it assumes
Assumes familiarity with C# startup configuration, JSON settings, and Docker volume mounting.
What you can do after
Operate/configure an application to read an optional JSON file and bind one of its configuration sections.
How it connects
Connects JSON configuration with user secrets, configuration sources, Docker volumes, and configuration binding.

Also explained in

Compare how 2 books explain JSON file provider →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET in Action, Second Edition. The section links point to the parts of the book it draws on.