Structr
Search
K
Comment on page

JSON-file

JsonSettingsProvider provides functionality for access to a JSON-file with settings.

Setup

Create settings class.
public class SmtpEmailSettings
{
public string Host { get; set; }
public int Port { get; set; }
}
Create JSON file with settings:
{
"Host": "smtp.example.com",
"Port": 25
}
Setup JSON-file settings provider:
services.AddConfiguration()
.AddJson<SmtpEmailSettings>("path_to_json_file");
Last modified 1yr ago