From ac528c5db6c9b881398ef17ca6ed595e067b895b Mon Sep 17 00:00:00 2001 From: Wildan M Date: Thu, 26 Sep 2024 08:07:39 +0700 Subject: [PATCH] Allow missing values --- src/executor/nginx.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/executor/nginx.js b/src/executor/nginx.js index a8318bf..04f3e3d 100644 --- a/src/executor/nginx.js +++ b/src/executor/nginx.js @@ -347,13 +347,13 @@ class NginxExecutor { let hasApex = servernames.includes(domain); let hasWww = servernames.includes('www.' + domain); data.www = (hasApex ? 1 : 0) + (hasWww ? 2 : 0); - data.root = node.root ? node.root[0]._value : ""; + data.root = node.root[0]?._value || ""; data.user = data.root.split('/')[2]; data.home = `/home/${data.user}/`; - data.access_log = node.access_log[0]._value; - data.error_log = node.error_log[0]._value; - data.ssl_certificate = node.ssl_certificate ? node.ssl_certificate[0]._value : data.home + `ssl.cert`; - data.ssl_certificate_key = node.ssl_certificate_key ? node.ssl_certificate_key[0]._value : data.home + `ssl.key`; + data.access_log = node.access_log[0]?._value; + data.error_log = node.error_log[0]?._value; + data.ssl_certificate = node.ssl_certificate[0]?._value || data.home + `ssl.cert`; + data.ssl_certificate_key = node.ssl_certificate_key[0]?._value || data.home + `ssl.key`; data.fcgi = findFastCgi(node); data.docker_ip = findDockerIp(node);