From 156de4e84c0ac0de552ddec01ec00b508bf28719 Mon Sep 17 00:00:00 2001 From: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com> Date: Mon, 22 Jun 2020 11:26:14 -0500 Subject: [PATCH] Add config comments --- settings.sample.json | 13 +++++++------ src/main/kotlin/mdnet/base/Constants.kt | 4 +++- src/main/kotlin/mdnet/base/Main.kt | 3 +++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/settings.sample.json b/settings.sample.json index eec2dd0..cd7ab41 100755 --- a/settings.sample.json +++ b/settings.sample.json @@ -1,14 +1,15 @@ { "client_secret": "nosenpaithisisoursecret", - "client_hostname": "0.0.0.0", - "client_port": 44300, + "client_hostname": "0.0.0.0", // "0.0.0.0" is the default and binds to everything + "client_port": 443, // 443 is recommended if possible "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_kilobits_per_second": 0, - "max_mebibytes_per_hour": 0, + "max_kilobits_per_second": 0, // 0 disables max brust limiting + "max_mebibytes_per_hour": 0, // 0 disables hourly bandwidth limiting "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 } } diff --git a/src/main/kotlin/mdnet/base/Constants.kt b/src/main/kotlin/mdnet/base/Constants.kt index c1076ef..028f889 100644 --- a/src/main/kotlin/mdnet/base/Constants.kt +++ b/src/main/kotlin/mdnet/base/Constants.kt @@ -1,5 +1,7 @@ package mdnet.base +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import java.time.Duration @@ -8,5 +10,5 @@ object Constants { const val CLIENT_VERSION = "1.0" const val WEBUI_VERSION = "0.1.1" val MAX_AGE_CACHE: Duration = Duration.ofDays(14) - val JACKSON = jacksonObjectMapper() + val JACKSON: ObjectMapper = jacksonObjectMapper().configure(JsonParser.Feature.ALLOW_COMMENTS, true) } diff --git a/src/main/kotlin/mdnet/base/Main.kt b/src/main/kotlin/mdnet/base/Main.kt index 85cdee0..6ecf668 100644 --- a/src/main/kotlin/mdnet/base/Main.kt +++ b/src/main/kotlin/mdnet/base/Main.kt @@ -88,6 +88,9 @@ object Main { if (settings.maxKilobitsPerSecond < 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.uiPort == 0) { dieWithError("Config Error: Invalid UI port number")