Application Settings

Application Settings

DBGate reads the configuration from the JSON configuration files like appsettings.json and appsettings.Production.json.

See details at JSON Configuration Provider.

Below is a default appsettings.json file:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  }
}

Keys and sections:

Logging
See details at Logging Configuration.

Below is a sample of appsettings.Production.json file:

{
  "Kestrel": {
    "EndPoints": {
      "Http": {
        "Url": "http://localhost:5003"
      }
    }
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning",
      "System": "Information",
      "Microsoft": "Information"
    }
  },
  "ApiRoot": "api",
  "EditRoots": "edit",
  "EditPages": {
    "edit": "edit.htm",
  },
  "DisableMetadataCache": false,
  "ConnectionStrings": {
    "mssql": {
      "ProviderName": "System.Data.SqlClient",
      "ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=AzureDemo90;User ID=user;Pwd=pass"
    },
    "mssql-201": {
      "ProviderName": "System.Data.SqlClient",
      "ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=AzureDemo90;User ID=sample20_user1;Pwd=Usr_2011#_Xls4168"
    }
  }
}

Keys and sections:

Kestrel
See details at Kestrel web server implementation in ASP.NET Core.
Use it to change the endpoint port.
Logging
See details at Logging Configuration.
ApiRoot
This value defines an API root, like 'api' in the /api/mssql/ endpoint.
The value is common for all endpoints.
EditRoots
This space-separated value defines edit roots, like 'edit' in the /edit/mssql/ endpoint.
EditPages
This dictionary defines HTML pages for edit roots.
For example, DBGate returns the edit.htm page content for the /edit/mssql/ endpoint.
DisableMetadataCache
This value allows disabling the metadata model cache. Developers may use it to load the model from a database every time.
ConnectionStrings
This dictionary defines connection names and related connection strings.
DBGate uses connection names to configure endpoints. For example, the sample defines base endpoints like /api/mssql/ and /api/mssql-011/.
ProviderName
This value defines a provider name.
ConnectionString
This value defines a connection string.
Use a real username and password or the 'user' and 'pass' placeholders.
In the last case, DBGate requires a username and password when a user connects to the endpoint.