From 11b1af55ba007703adecf4ec91a1a73f414d2278 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Fri, 8 Jan 2021 13:23:47 -0500 Subject: [PATCH] strings are passed to the openresty conf from the node app via the unix socket --- nodejs/controler/host.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nodejs/controler/host.js b/nodejs/controler/host.js index 778563e..c0af1a0 100644 --- a/nodejs/controler/host.js +++ b/nodejs/controler/host.js @@ -8,9 +8,14 @@ const conf = require('../app').conf; const socket = new SocketServerJson({ socketFile: conf.socketFile, onData: function(data, clientSocket) { - let host = Host.lookUp(data['domain']); - clientSocket.write(JSON.stringify(host || {host: 'none'})); - if(host){ + let host = Host.lookUp(data['domain']) || {host: 'none'}; + + for (const [key, value] of Object.entries(host)) { + host[key] = String(value); + }; + + clientSocket.write(JSON.stringify(host)); + if(host.ip){ try{ Host.addCache(data['domain'], host) }catch(error){