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

Code before:
            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`]);

    // v6
    if (domain.server.listenIpv6.computed)
        config.push(['listen', `[${domain.server.listenIpv6.computed}]:80`]);

    return config;
};

const listenConfig = domain => {
    if (domain.https.https.computed) return httpsListen(domain);
    return httpListen(domain);

Review comment (suggestion):
```suggestion
            `[${domain.server.listenIpv6.computed}]:443 ssl${domain.https.http2.computed ? ' http2' : ''}`]);
```
Please revert this change so there is a clean diff

Code after:
            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`]);

    // v6
    if (domain.server.listenIpv6.computed)
        config.push(['listen', `[${domain.server.listenIpv6.computed}]:80`]);

    return config;
};

const listenConfig = domain => {
    if (domain.https.https.computed) return httpsListen(domain);
    return httpListen(domain);
};