From 690fc3afa3ce857cb40f75eb896c9a1e326e35f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=9F=E8=BF=9B?= Date: Tue, 25 Sep 2018 11:33:04 +0800 Subject: [PATCH] Update main.js --- main.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/main.js b/main.js index 5428caa..44c15ca 100644 --- a/main.js +++ b/main.js @@ -297,5 +297,28 @@ function main() { }); + // try to load certificates + if (adapter.config.secure) { + // Load certificates + // Load certificates + adapter.getCertificates(function (err, certificates, leConfig) { + adapter.config.certificates = certificates; + adapter.config.leConfig = leConfig; + initWebServer(adapter.config); + }); + } else { + initWebServer(adapter.config); + } + + // Convert port to number + adapter.config.interval = parseInt(adapter.config.interval, 10); + + // If interval and URl are set => poll it every X milliseconds + if (adapter.config.interval && adapter.config.pollURL) { + // initial poll + pollData(); + // poll every x milliseconds + timer = setInterval(pollData, adapter.config.interval); + } }