From 63bb147d0392b6e614f7ecaf771ff3e883e4b734 Mon Sep 17 00:00:00 2001 From: Ferenc Schulcz <schulcz.ferenc@gmail.com> Date: Sun, 4 Feb 2024 18:11:43 +0100 Subject: [PATCH] Make server address/port configurable --- config.json.defaults | 4 +++- index.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.json.defaults b/config.json.defaults index 34b0a7c..657c72b 100644 --- a/config.json.defaults +++ b/config.json.defaults @@ -1,4 +1,6 @@ { "higherLevelDomain": "dyndns.mydomain.com", - "dbHost": "localhost" + "dbHost": "localhost", + "listenAddress": "127.0.0.1", + "listenPort": 3000 } \ No newline at end of file diff --git a/index.js b/index.js index aa62340..6f69d96 100644 --- a/index.js +++ b/index.js @@ -20,8 +20,8 @@ app.get('/register', registerMW(), replyMW()); // update an existing dyndns record app.get('/update', updateMW(), replyMW()); -const server_port = 3000; -const server_domain = '0.0.0.0'; +const server_port = config.config().listenPort; +const server_domain = config.config().listenAddress; app.listen(server_port, server_domain, function () { console.log(`This server is listening on http://${server_domain}:${server_port}`); }); \ No newline at end of file -- GitLab