From 67824f6a375c640c2a5e7489b6b3490ee1a975e8 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Tue, 3 Jan 2023 22:00:31 +0100 Subject: [PATCH] Document configuration default values (#91) --- README.md | 14 ++++++++++++++ code-generation/config-scheme-gen.js | 3 +++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index 5638f82..f770e9a 100644 --- a/README.md +++ b/README.md @@ -133,16 +133,22 @@ Once *Prometheus* is restarted, metrics with the `homebridge_` prefix should sta // Debug + // + // Default: false "debug": "", // Metrics prefix + // + // Default: "homebridge" "prefix": "", // Metrics server port // // TCP port where the Prometheus metrics server listens + // + // Default: 36123 "port": "", @@ -151,24 +157,32 @@ Once *Prometheus* is restarted, metrics with the `homebridge_` prefix should sta // Interface where the Prometheus metrics server listens. Can be an IP, a // hostname, "0.0.0.0" for all IPv4 interfaces, "::1" for all IPv6 interfaces. // Default is "::" which means "any interface" + // + // Default: "::" "interface": "", // Service refresh interval // // Discover new services every seconds + // + // Default: 60 "refresh_interval": "", // Request timeout // // Request timeout when interacting with homebridge instances + // + // Default: 10 "request_timeout": "", // Service discovery timeout // // Discovery timeout after which the current discovery is considered failed + // + // Default: 20 "discovery_timeout": "", diff --git a/code-generation/config-scheme-gen.js b/code-generation/config-scheme-gen.js index fbc6f93..c739c3c 100755 --- a/code-generation/config-scheme-gen.js +++ b/code-generation/config-scheme-gen.js @@ -56,6 +56,9 @@ function generateDocs(schema) { if (definition.description) { lines.push(`//\n// ${wordwrap(definition.description, 80, '\n// ')}`) } + if (definition.default !== undefined) { + lines.push(`//\n// Default: ${JSON.stringify(definition.default)}`) + } lines.push(`${JSON.stringify(property)}: ${JSON.stringify('<' + definition.type + '>')}`)