tlsopt.js
function readSync() {
    const TLS_CERT = process.env.TLS_CERT;
    const TLS_KEY = process.env.TLS_KEY;
    const TLS_CA = process.env.TLS_CA;
    const tls_cert = readOpt("--tls-cert");
    const tls_key = readOpt("--tls-key");
    const tls_ca = readOpt("--tls-ca");
    const result = {
        secureOptions: constants.SSL_OP_NO_TLSv1
    };    

    if (tls_cert) {
        if (tls_key) {
            result.cert = fs.readFileSync(tls_cert);
            result.key = fs.readFileSync(tls_key);

            if (tls_ca) {
                result.ca = fs.readFileSync(tls_ca);
            }
        } else {
            result.pfx = fs.readFileSync(tls_cert);
        }
    } else if (TLS_CERT) {
        if (TLS_KEY) {
            result.cert = fs.readFileSync(TLS_CERT);
            result.key = fs.readFileSync(TLS_KEY);

            if (TLS_CA) {
                result.ca = fs.readFileSync(TLS_CA);
            }
        } else {
            result.pfx = fs.readFileSync(TLS_CERT);
        }
    }

    return result;
}
function readSync() {
    const TLS_CERT = process.env.TLS_CERT;
    const TLS_KEY = process.env.TLS_KEY;
    const TLS_CA = process.env.TLS_CA;
    const tls_cert = readOpt("--tls-cert");
    const tls_key = readOpt("--tls-key");
    const tls_ca = readOpt("--tls-ca");
    const result = {
        secureOptions: constants.SSL_OP_NO_TLSv1
    };    

    if (tls_cert) {
        if (tls_key) {
            result.cert = fs.readFileSync(tls_cert);
            result.key = fs.readFileSync(tls_key);

            if (tls_ca) {
                result.ca = fs.readFileSync(tls_ca);
            }
        } else {
            result.pfx = fs.readFileSync(tls_cert);
        }
    } else if (TLS_CERT) {
        if (TLS_KEY) {
            result.cert = fs.readFileSync(TLS_CERT);
            result.key = fs.readFileSync(TLS_KEY);

            if (TLS_CA) {
                result.ca = fs.readFileSync(TLS_CA);
            }
        } else {
            result.pfx = fs.readFileSync(TLS_CERT);
        }
    }

    return result;
}
Read TLS options from filesystem synchronously.  Paths are read from CLI
options or environment variables.
@returns {object}