Add config comments

This commit is contained in:
carbotaniuman 2020-06-22 11:26:14 -05:00
parent 38392d342a
commit 156de4e84c
3 changed files with 13 additions and 7 deletions

View file

@ -1,14 +1,15 @@
{ {
"client_secret": "nosenpaithisisoursecret", "client_secret": "nosenpaithisisoursecret",
"client_hostname": "0.0.0.0", "client_hostname": "0.0.0.0", // "0.0.0.0" is the default and binds to everything
"client_port": 44300, "client_port": 443, // 443 is recommended if possible
"threads": 16, "threads": 16,
"graceful_shutdown_wait_seconds": 60, "graceful_shutdown_wait_seconds": 60, // Time from graceful shutdown start to force quit
// This rounds down to 15-second increments
"max_cache_size_in_mebibytes": 80000, "max_cache_size_in_mebibytes": 80000,
"max_kilobits_per_second": 0, "max_kilobits_per_second": 0, // 0 disables max brust limiting
"max_mebibytes_per_hour": 0, "max_mebibytes_per_hour": 0, // 0 disables hourly bandwidth limiting
"web_settings": { "web_settings": {
"ui_hostname": "127.0.0.1", "ui_hostname": "127.0.0.1", // "0.0.0.0" is the default and binds to localhost only
"ui_port": 8080 "ui_port": 8080
} }
} }

View file

@ -1,5 +1,7 @@
package mdnet.base package mdnet.base
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import java.time.Duration import java.time.Duration
@ -8,5 +10,5 @@ object Constants {
const val CLIENT_VERSION = "1.0" const val CLIENT_VERSION = "1.0"
const val WEBUI_VERSION = "0.1.1" const val WEBUI_VERSION = "0.1.1"
val MAX_AGE_CACHE: Duration = Duration.ofDays(14) val MAX_AGE_CACHE: Duration = Duration.ofDays(14)
val JACKSON = jacksonObjectMapper() val JACKSON: ObjectMapper = jacksonObjectMapper().configure(JsonParser.Feature.ALLOW_COMMENTS, true)
} }

View file

@ -88,6 +88,9 @@ object Main {
if (settings.maxKilobitsPerSecond < 0) { if (settings.maxKilobitsPerSecond < 0) {
dieWithError("Config Error: Max burst rate must be >= 0") dieWithError("Config Error: Max burst rate must be >= 0")
} }
if (settings.gracefulShutdownWaitSeconds < 15) {
dieWithError("Config Error: Graceful shutdown wait be >= 15")
}
if (settings.webSettings != null) { if (settings.webSettings != null) {
if (settings.webSettings.uiPort == 0) { if (settings.webSettings.uiPort == 0) {
dieWithError("Config Error: Invalid UI port number") dieWithError("Config Error: Invalid UI port number")