Repository: digitalocean/nginxconfig.io
File: src/nginxconfig/generators/conf/website.conf.js (JavaScript)

Code before:
import joomlaConf from './joomla.conf';
import letsEncryptConf from './letsencrypt.conf';
import phpPath from '../../util/php_path';
import phpUpstream from '../../util/php_upstream';

const sslConfig = (domain, global) => {
    const config = [];
    if (domain.https.https.computed) {
        config.push(['# SSL', '']);
        config.push(['ssl_certificate', getSslCertificate(domain, global)]);
        config.push(['ssl_certificate_key', getSslCertificateKey(domain, global)]);

        // Let's encrypt
        if (domain.https.certType.computed === 'letsEncrypt')
            config.push(['ssl_trusted_certificate',
                `${global.https.letsEncryptCertRoot.computed.replace(/\/+$/, '')}/${domain.server.domain.computed}/chain.pem`]);
    }
    return config;
};

const httpsListen = domain => {
    const config = [];

    // HTTPS
    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' : ''}`,
        ]);
    
    // v6
    if (domain.server.listenIpv6.computed)
        config.push(['listen',
            `[${domain.server.listenIpv6.computed}]:443 ssl${domain.https.http2.computed ? ' http2' : ''}`]);
    
    // 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' : ''}`,
        ]);
    return config;
};

const httpListen = domain => {
    const config = [];

    // Not HTTPS
    config.push(['listen', `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`]);

Review comment (suggestion):
```suggestion

```
You've got some trailing whitespace here now :P

Code after:
import joomlaConf from './joomla.conf';
import letsEncryptConf from './letsencrypt.conf';
import phpPath from '../../util/php_path';
import phpUpstream from '../../util/php_upstream';

const sslConfig = (domain, global) => {
    const config = [];
    if (domain.https.https.computed) {
        config.push(['# SSL', '']);
        config.push(['ssl_certificate', getSslCertificate(domain, global)]);
        config.push(['ssl_certificate_key', getSslCertificateKey(domain, global)]);

        // Let's encrypt
        if (domain.https.certType.computed === 'letsEncrypt')
            config.push(['ssl_trusted_certificate',
                `${global.https.letsEncryptCertRoot.computed.replace(/\/+$/, '')}/${domain.server.domain.computed}/chain.pem`]);
    }
    return config;
};

const httpsListen = domain => {
    const config = [];

    // HTTPS
    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' : ''}`,
        ]);

    // v6
    if (domain.server.listenIpv6.computed)
        config.push(['listen',
            `[${domain.server.listenIpv6.computed}]:443 ssl${domain.https.http2.computed ? ' http2' : ''}`]);

    // 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' : ''}`,
        ]);
    return config;
};

const httpListen = domain => {
    const config = [];

    // Not HTTPS
    config.push(['listen', `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`]);