DBGate 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,
"StopEnabled": false,
"ConnectionStrings": {
"mssql": {
"ProviderName": "System.Data.SqlClient",
"ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=AzureDemo90;User ID=user;Pwd=pass"
},
"mssql-201": {
"QueryList": "",
"HiddenSchemas": "logs doc xls",
"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 can use it to load the model from a database every time.
- StopEnabled
- This value allows stopping the application using the /api/$stop request.
- 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.
- QueryList
- This value defines a view in the SaveToDB QueryList format to advertise the view objects only in the service document.
Use this feature to configure the entity container and keep the service root clear.
- HiddenSchemas
- This space-separated value defines a list of schemas not to advertise their objects in the service document.