Skip to content

Server Configuration

Don Kackman edited this page Mar 17, 2024 · 4 revisions

DotNetCore Configuration

DIG is built with ASP.NET Core and uses its configuration providers.

Settings locations

The dig.server component loads configuration settings in this order, with the each set of configuration values taking precedence over those already loaded:

  1. appsettings.json in the folder with the executable. These are the default values.
  2. From environment variables. DIG specific settings will be prefixed with dig:.
  3. From appsettings.json in ~/.dig. These are installation specific settings that might get set by an installer.
  4. From appsettings.user.json in ~/.dig. These are the user specified settings and override everything but the command line.
  5. A fully qualified path to a settings json file passed to dig.server on the command line.

Logging

Logging can be configured in any of the above settings locations.

A typical logging configuration section looks like:

    "Logging": {
        "LogLevel": {
            "Default": "Information",
            "Microsoft.AspNetCore": "Information",
            "Microsoft.Hosting.Lifetime": "Information",
            "Microsoft.EntityFrameworkCore": "Information",
            "System.Net.Http": "Error",
            "Polly": "Error"
        },
        "Console": {
            "IncludeScopes": false,
            "LogLevel": {
                "Microsoft.EntityFrameworkCore": "Information",
                "Default": "Information",
                "Polly": "Error",
                "System.Net.Http": "Error"
            }
        }
    },

Web Server

By default dig.server will use the built-in ASP.NET web server, Kestrel.

The default Kestrel configuration binds to port 41410 and does not use TLS.

    "Kestrel": {
        "Endpoints": {
            "Http": {
                "Url": "http://0.0.0.0:41410"
            }
        }
    },

If you have TLS certificates you can configure Kestrel to use them following this letsencrypt example:

    "https_port": 8787,
    "Kestrel": {
        "Endpoints": {
            "HttpsInlineCertAndKeyFile": {
                "Url": "https://0.0.0.0:8787",
                "Certificate": {
                    "Path": "/etc/letsencrypt/live/<domain>/fullchain.pem",
                    "KeyPath": "/etc/letsencrypt/live/<domain>/privkey.pem"
                }
            }
        }
    }

It is also possible to host Kestrel behind a reverse proxy such as IIS, Apache, and Nginx.

Clone this wiki locally