From 8c3e0b01007c96f388454bf04424b972cf25ff37 Mon Sep 17 00:00:00 2001 From: MattIPv4 Date: Mon, 29 Mar 2021 20:50:56 +0100 Subject: [PATCH] More consistent line wrapping --- .../generators/conf/website.conf.js | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/nginxconfig/generators/conf/website.conf.js b/src/nginxconfig/generators/conf/website.conf.js index 2da113e..95f0da2 100644 --- a/src/nginxconfig/generators/conf/website.conf.js +++ b/src/nginxconfig/generators/conf/website.conf.js @@ -60,14 +60,13 @@ const httpsListen = domain => { const config = []; // HTTPS - config.push(['listen', `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 ssl${domain.https.http2.computed ? ' http2' : ''}`]); + config.push(['listen', + `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 ssl${domain.https.http2.computed ? ' http2' : ''}`]); // HTTP/3 if (domain.https.http3.computed) config.push(['listen', - `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 http3` - + `${domain.https.portReuse.computed ? ' reuseport' : ''}`, - ]); + `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`]); // v6 if (domain.server.listenIpv6.computed) @@ -77,8 +76,8 @@ const httpsListen = domain => { // v6 HTTP/3 if (domain.server.listenIpv6.computed && domain.https.http3.computed) config.push(['listen', - `[${domain.server.listenIpv6.computed}]:443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`, - ]); + `[${domain.server.listenIpv6.computed}]:443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`]); + return config; }; @@ -86,7 +85,8 @@ const httpListen = domain => { const config = []; // Not HTTPS - config.push(['listen', `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`]); + config.push(['listen', + `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`]); // v6 if (domain.server.listenIpv6.computed) @@ -204,7 +204,8 @@ export default (domain, domains, global) => { serverConfig.push(['# logging', '']); if (domain.logging.accessLog.computed) - serverConfig.push(['access_log', getAccessLogDomainPath(domain, global) + (global.logging.cloudflare.computed ? ' cloudflare' : '')]); + serverConfig.push(['access_log', + getAccessLogDomainPath(domain, global) + (global.logging.cloudflare.computed ? ' cloudflare' : '')]); if (domain.logging.errorLog.computed) serverConfig.push(['error_log', getErrorLogDomainPath(domain, global)]); @@ -383,12 +384,14 @@ export default (domain, domains, global) => { const redirectConfig = []; redirectConfig.push(...listenConfig(domain)); - redirectConfig.push(['server_name', `${domain.server.wwwSubdomain.computed ? '' : '*'}.${domain.server.domain.computed}`]); + redirectConfig.push(['server_name', + `${domain.server.wwwSubdomain.computed ? '' : '*'}.${domain.server.domain.computed}`]); // HTTPS redirectConfig.push(...sslConfig(domain, global)); - redirectConfig.push(['return', `301 http${domain.https.https.computed ? 's' : ''}://${domain.server.wwwSubdomain.computed ? 'www.' : ''}${domain.server.domain.computed}$request_uri`]); + redirectConfig.push(['return', + `301 http${domain.https.https.computed ? 's' : ''}://${domain.server.wwwSubdomain.computed ? 'www.' : ''}${domain.server.domain.computed}$request_uri`]); // Add the redirect config to the parent config now its built config.push([`# ${domain.server.wwwSubdomain.computed ? 'non-www, ' : ''}subdomains redirect`, '']); @@ -400,7 +403,8 @@ export default (domain, domains, global) => { // Add the redirect config to the parent config now its built config.push(['# HTTP redirect', '']); if (domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) { - config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed, `www.${domain.server.domain.computed}`)]); + config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed, + `www.${domain.server.domain.computed}`)]); config.push(['server', httpRedirectConfig(domain, global, `www.${domain.server.domain.computed}`)]); } else if (!domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) { config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed)]); @@ -409,7 +413,8 @@ export default (domain, domains, global) => { config.push(['server', httpRedirectConfig(domain, global, `cdn.${domain.server.domain.computed}`)]); } if (domain.server.redirectSubdomains.computed) { - config.push(['server', httpRedirectConfig(domain, global, `.${domain.server.domain.computed}`, `${domain.server.wwwSubdomain.computed ? 'www.' : '' }${domain.server.domain.computed}`)]); + config.push(['server', httpRedirectConfig(domain, global, `.${domain.server.domain.computed}`, + `${domain.server.wwwSubdomain.computed ? 'www.' : '' }${domain.server.domain.computed}`)]); } }