Configuration - _reservemanager-configuration.json

The API Server uses a hiearchy of configuration settings for its configuration management using ASP.NET's configuration system. Settings are read on startup in this order:

  • _reservemanager-configuration.json
    • appsettings.json
      • appsettings.Development.json
      • appsettings.Release.json
        • Environment variables

_reservemanager-configuration.json is the base configuration from which values are read

_reservemanager-configuration.json

This is the base configuration - preferrably most if not all setting changes should be made here so they are kept in a single file location.

{
  "ApplicationName": "Reserve Manager",
  "ApplicationCompany": "Reserve Manager Company",
  "ConnectionString": "Data Source=serverOrIp,optionalPort;Initial Catalog=ReserveFundManager2;uid=username;pwd=superSeekrit#212;encrypt=false",
  "BaseUrl": "https://localhost:5200/",
  "LoginSiteBaseUrl": "https://localhost:5173/",
  "Email": {
    "AdminSenderEmail": "",
    "MailServer": "smtp.mailgun.org:587",
    "MailServerUsername": "uid@domain.com",
    "MailServerPassword": "superSeekrit#213",
    "SenderEmail": "wjp@reservemanager.com",
    "SenderName": "support@reservemanager.com",
    "UseTls": true,
    "CcList": "",
    "AdminCcList": "",
    "SendAdminEmails": false,
    "SendEmails": true
  },
  "ImageUploadSize": "1280x720",
  "EncryptAccountPasswords": true
}

This file is installation specific so needs to be customized for each specific installation (ie. dev, staging, production servers).

You can then override if absolutely necessary using ASP.NET's config file and environment overrides.

ASP.NET Standard Configuration Inheritance

You can override using ASP.NET's standard override files:

  • appsettings.json (including the .Development and .Release extensions)
  • Environment Variables

AppSettings.json

You can override in any of the appsetting.json override files by adding a ReserveManager section like this:

{
	"Logging": {
		"LogLevel": {
			"Default": "Information",
			"Microsoft.AspNetCore": "Warning"
		}
	},
	// THIS!
	"ReserveManager": {
		"ApplicationName": "ReserveManager AppSettings"
	},
	"AllowedHosts": "*",
	"ConnectionStrings": {
		"Default": "..."
		"AssetManager1": "...",
		"JsonConnection": "Uri=https://localhost:5200/"
	}
}

You can override any values that match in appsettings.json or the derivatives like appsettings.Development.json.

Environment Variables

You can also use environment variables which can be set like this:

SET ReserverMnager__ApplicationName = = "Reserve Manager CMD Environment"
$env:ReserveManager__ApplicationName = "Reserve Manager PS Environment"