Skip to content

Instantly share code, notes, and snippets.

@ThomasArdal
Created March 23, 2021 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasArdal/f522c9b01eab419479cb56e3b16e9d60 to your computer and use it in GitHub Desktop.
Save ThomasArdal/f522c9b01eab419479cb56e3b16e9d60 to your computer and use it in GitHub Desktop.
{
"title": "JSON schema ASP.NET Core's appsettings.json file",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"definitions": {
"webOptimizer": {
"type": "object",
"description": "Settings for WebOptimizer.Core",
"properties": {
"enableCaching": {
"description": "Determines if the \"cache-control\" HTTP headers should be set and if conditional GET (304) requests should be supported. This could be helpful to disable while in development mode.",
"type": "boolean"
},
"enableTagHelperBundling": {
"description": "Determines if `<script>` and `<link>` elements should point to the bundled path or a reference per source file should be created. This is helpful to disable when in development mode.",
"type": "boolean",
"default": true
}
}
},
"cdn": {
"type": "object",
"description": "Definitions for WebEssentials.AspNetCore.CdnTagHelpers",
"properties": {
"url": {
"description": "An absolute URL used as a prefix for static resources",
"type": "string",
"pattern": "^((//|https?://).+|)$"
},
"prefetch": {
"description": "If true, injects a <link rel='dns-prefetch'> tag that speeds up DNS resolution to the CDN.",
"type": "boolean",
"default": true
}
}
},
"pwa": {
"properties": {
"cacheId": {
"description": "The cache identifier of the service worker (can be any string). Change this property to force the service worker to reload in browsers.",
"type": "string",
"default": "v1.0"
},
"offlineRoute": {
"description": "The route to the page to show when offline.",
"type": "string",
"default": "/offline.html"
},
"registerServiceWorker": {
"description": "Determines if a script that registers the service worker should be injected into the bottom of the HTML page.",
"type": "boolean",
"default": true
},
"registerWebmanifest": {
"description": "Determines if a meta tag that points to the web manifest should be inserted at the end of the head element.",
"type": "boolean",
"default": true
},
"routesToPreCache": {
"description": "A comma separated list of routes to pre-cache when service worker installs in the browser.",
"type": "string",
"default": ""
},
"strategy": {
"description": "Selects one of the predefined service worker types.",
"enum": [
"cacheFirst",
"cacheFirstSafe",
"minimal",
"networkFirst"
],
"default": "cacheFirstSafe"
}
}
},
"ElmahIo": {
"properties": {
"ApiKey": {
"description": "An elmah.io API key with the Messages | Write permission.",
"type": "string",
"pattern": "^[0-9a-f]{32}$"
},
"LogId": {
"description": "The Id of the elmah.io log to store messages in.",
"type": "string",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
},
"HeartbeatId": {
"description": "The Id of the elmah.io heartbeat to notify.",
"type": "string",
"pattern": "^[0-9a-f]{32}$"
}
},
"required": [
"ApiKey",
"LogId"
]
},
"protocols": {
"description": "The protocols enabled on the endpoint.",
"type": "string",
"enum": [
"None",
"Http1",
"Http2",
"Http1AndHttp2",
"Http3",
"Http1AndHttp2AndHttp3"
]
},
"certificate": {
"description": "Certificate configuration.",
"type": "object",
"properties": {
"Path": {
"description": "The certificate file path. If a file path is specified then the certificate will be loaded from the file system.",
"type": "string"
},
"KeyPath": {
"description": "The certificate key file path. Available in .NET 5 and later.",
"type": "string"
},
"Password": {
"description": "The certificate password used to access the private key.",
"type": "string"
},
"Subject": {
"description": "The certificate subject. If a subject is specified then the certificate will be loaded from the certificate store.",
"type": "string"
},
"Store": {
"description": "The certificate store name. Defaults to 'My'.",
"type": "string",
"default": "My"
},
"Location": {
"description": "The certificate store location. Defaults to 'CurrentUser'.",
"type": "string",
"enum": [
"LocalMachine",
"CurrentUser"
],
"default": "CurrentUser"
},
"AllowInvalid": {
"description": "A value indicating whether or not to load certificates that are considered invalid. Defaults to false.",
"type": "boolean",
"default": false
}
}
},
"sslProtocols": {
"description": "Specifies allowable SSL protocols. Defaults to 'None' which allows the operating system to choose the best protocol to use, and to block protocols that are not secure. Unless your app has a specific reason not to, you should use this default. Available in .NET 5 and later.",
"type": "array",
"items": {
"type": "string",
"enum": [
"None",
"Tls",
"Tls11",
"Tls12",
"Tls13"
],
"default": "None"
}
},
"clientCertificateMode": {
"description": "Specifies the client certificate requirements for a HTTPS connection. Defaults to 'NoCertificate'. Available in .NET 5 and later.",
"type": "string",
"enum": [
"NoCertificate",
"AllowCertificate",
"RequireCertificate"
],
"default": "NoCertificate"
},
"kestrel": {
"type": "object",
"description": "ASP.NET Core Kestrel server configuration.",
"properties": {
"Endpoints": {
"description": "Endpoints that Kestrel listens to for network requests. Each endpoint has a name specified by its JSON property name.",
"type": "object",
"additionalProperties": {
"description": "Kestrel endpoint configuration.",
"type": "object",
"properties": {
"Url": {
"description": "The scheme, host name, and port the endpoint will listen on. A Url is required.",
"type": "string",
"format": "uri"
},
"Protocols": {
"$ref": "#/definitions/protocols"
},
"SslProtocols": {
"$ref": "#/definitions/sslProtocols"
},
"Certificate": {
"$ref": "#/definitions/certificate"
},
"ClientCertificateMode": {
"$ref": "#/definitions/clientCertificateMode"
},
"Sni": {
"description": "Server Name Indication (SNI) configuration. This enables the mapping of client requested host names to certificates and other TLS settings. Wildcard names prefixed with '*.', as well as a top level '*' are supported. Available in .NET 5 and later.",
"type": "object",
"additionalProperties": {
"description": "Endpoint SNI configuration.",
"type": "object",
"properties": {
"Protocols": {
"$ref": "#/definitions/protocols"
},
"SslProtocols": {
"$ref": "#/definitions/sslProtocols"
},
"Certificate": {
"$ref": "#/definitions/certificate"
},
"ClientCertificateMode": {
"$ref": "#/definitions/clientCertificateMode"
}
}
}
}
},
"required": [
"Url"
]
}
},
"EndpointDefaults": {
"description": "Default configuration applied to all endpoints. Named endpoint specific configuration overrides defaults.",
"type": "object",
"properties": {
"Protocols": {
"$ref": "#/definitions/protocols"
},
"SslProtocols": {
"$ref": "#/definitions/sslProtocols"
},
"ClientCertificateMode": {
"$ref": "#/definitions/clientCertificateMode"
}
}
},
"Certificates": {
"description": "Certificates that Kestrel uses with HTTPS endpoints. Each certificate has a name specified by its JSON property name. The 'Default' certificate is used by HTTPS endpoints that haven't specified a certificate.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/certificate"
}
}
}
},
"logLevelThreshold": {
"description": "Log level threshold.",
"type": "string",
"enum": [
"Trace",
"Debug",
"Information",
"Warning",
"Error",
"Critical",
"None"
]
},
"logLevel": {
"description": "Log level configurations used when creating logs. Only logs that exceeds its matching log level will be enabled. Each log level configuration has a category specified by its JSON property name. For more information about configuring log levels, see https://docs.microsoft.com/aspnet/core/fundamentals/logging/#configure-logging.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/logLevelThreshold"
}
},
"logging": {
"type": "object",
"description": "Configuration for Microsoft.Extensions.Logging.",
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
},
"Console": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
},
"FormatterName": {
"description": "Name of the log message formatter to use. Defaults to 'simple'.",
"type": "string",
"default": "simple"
},
"FormatterOptions": {
"description": "Log message formatter options. Additional properties are available on the options depending on the configured formatter. The formatter is specified by FormatterName.",
"type": "object",
"properties": {
"IncludeScopes": {
"description": "Include scopes when true. Defaults to false.",
"type": "boolean",
"default": false
},
"TimestampFormat": {
"description": "Format string used to format timestamp in logging messages. Defaults to null.",
"type": "string"
},
"UseUtcTimestamp": {
"description": "Indication whether or not UTC timezone should be used to for timestamps in logging messages. Defaults to false.",
"type": "boolean",
"default": false
}
}
},
"LogToStandardErrorThreshold": {
"description": "The minimum level of messages are written to Console.Error.",
"$ref": "#/definitions/logLevelThreshold"
}
}
},
"EventSource": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
},
"Debug": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
},
"EventLog": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
}
},
"additionalProperties": {
"type": "object",
"description": "Logging configuration for a provider. The provider name must match the configuration's JSON property property name.",
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
}
},
"allowedHosts": {
"description": "ASP.NET Core host filtering middleware configuration. Allowed hosts is a semicolon-delimited list of host names without port numbers. Requests without a matching host name will be refused. Host names may be prefixed with a '*.' wildcard, or use '*' to allow all hosts.",
"type": "string"
},
"connectionStrings": {
"description": "Connection string configuration. Get connection strings with the IConfiguration.GetConnectionString(string) extension method.",
"type": "object",
"additionalProperties": {
"description": "Connection string configuration. Each connection string has a name specified by its JSON property name.",
"type": "string"
}
},
"NLog": {
"type": "object",
"description": "NLog configuration",
"default": {},
"properties": {
"autoReload": {
"type": "boolean",
"description": "Watch for changes and reload automatically when changed.",
"default": false
},
"throwConfigExceptions": {
"type": [
"boolean",
"null"
],
"description": "Throws an exception when there is a config error? If not set, then throwExceptions will be used for this setting.",
"default": false
},
"throwExceptions": {
"type": "boolean",
"description": "Throws an exception when there is an error",
"default": false
},
"internalLogLevel": {
"type": "string",
"description": "The minimal log level for the internal logger.",
"enum": [
"Trace",
"Debug",
"Info",
"Warn",
"Error",
"Fatal",
"Off"
],
"default": "Off"
},
"internalLogFile": {
"type": "string",
"description": "Write internal log to a file"
},
"internalLogToConsole": {
"type": "boolean",
"description": "Write internal log to a console",
"default": "false"
},
"internalLogToConsoleError": {
"type": "boolean",
"description": "Write internal log to a console with error stream",
"default": "false"
},
"globalThreshold": {
"type": "string",
"description": "Log events below this threshold are not logged.",
"enum": [
"Trace",
"Debug",
"Info",
"Warn",
"Error",
"Fatal",
"Off"
],
"default": "Off"
},
"autoShutdown": {
"type": "boolean",
"description": "Automatically call `LogFactory.Shutdown` on AppDomain.Unload or AppDomain.ProcessExit",
"default": "true"
},
"extensions": {
"type": "array",
"description": "",
"default": [],
"items": {
"type": "object",
"description": "",
"default": {},
"properties": {
"assembly": {
"type": "string",
"description": ""
},
"prefix": {
"type": "string",
"description": "Item name prefix",
"default": ""
},
"type": {
"type": "string",
"description": "",
"default": ""
},
"assemblyFile": {
"type": "string",
"description": "",
"default": ""
}
}
}
},
"variables": {
"type": "object",
"description": "Key-value pair of variables",
"propertyNames": {
"pattern": "^[A-Za-z0-9_.-]+$"
},
"patternProperties": {
".*": {
"type": [
"number",
"string",
"boolean"
]
}
}
},
"default-wrapper": {
"type": "object",
"description": "",
"default": {},
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"description": ""
}
}
},
"targets": {
"type": "object",
"description": "",
"default": {}
},
"rules": {
"oneOf": [
{
"type": "array",
"description": "",
"default": [],
"items": {
"$ref": "#/NLog/properties/rules/item"
}
},
{
"type": "object",
"propertyNames": {
"pattern": "^[0-9]+$"
},
"patternProperties": {
".*": {
"$ref": "#/NLog/properties/rules/item"
}
}
}
]
}
}
},
"NLogRulesItem": {
"$id": "#/NLog/properties/rules/item",
"type": "object",
"description": "Send events to targets",
"default": {},
"required": [
"logger"
],
"properties": {
"logger": {
"type": "string",
"description": "Filter on the name of the logger. May include wildcard characters ('*' or '?')."
},
"ruleName": {
"type": "string",
"description": "Rule identifier to allow rule lookup with Configuration.FindRuleByName and Configuration.RemoveRuleByName."
},
"level": {
"anyOf": [
{
"type": "string",
"description": "",
"enum": [
"Trace",
"Debug",
"Info",
"Warn",
"Error",
"Fatal"
]
},
{
"type": "string"
}
]
},
"levels": {
"type": "string",
"description": "Comma separated list of levels that this rule matches."
},
"minLevel": {
"anyOf": [
{
"type": "string",
"description": "",
"enum": [
"Trace",
"Debug",
"Info",
"Warn",
"Error",
"Fatal"
]
},
{
"type": "string"
}
]
},
"maxLevel": {
"anyOf": [
{
"type": "string",
"description": "",
"enum": [
"Trace",
"Debug",
"Info",
"Warn",
"Error",
"Fatal"
]
},
{
"type": "string"
}
]
},
"writeTo": {
"type": "string",
"description": "Name or names of a target - separated by comma. Remove this property for sending events to the blackhole."
},
"final": {
"type": "boolean",
"description": "Ignore further rules if this one matches.",
"default": false
},
"enabled": {
"type": "boolean",
"description": "",
"default": false
},
"filters": {
"type": "object",
"description": "",
"default": {}
}
}
}
},
"properties": {
"Kestrel": {
"$ref": "#/definitions/kestrel"
},
"Logging": {
"$ref": "#/definitions/logging"
},
"AllowedHosts": {
"$ref": "#/definitions/allowedHosts"
},
"ConnectionStrings": {
"$ref": "#/definitions/connectionStrings"
}
},
"patternProperties": {
"^WebOptimizer$": {
"$ref": "#/definitions/webOptimizer"
},
"^webOptimizer$": {
"$ref": "#/definitions/webOptimizer"
},
"^weboptimizer$": {
"$ref": "#/definitions/webOptimizer"
},
"^(cdn|Cdn)$": {
"$ref": "#/definitions/cdn"
},
"^(pwa|PWA|Pwa)$": {
"$ref": "#/definitions/pwa"
},
"^(ElmahIo|Elmahio|elmahIo|elmahio)$": {
"$ref": "#/definitions/ElmahIo"
},
"^(nlog|Nlog|NLog)$": {
"$ref": "#/definitions/NLog"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment