From 94e3560cb44659d818ee460760711b2a884e93b7 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 21 Nov 2018 16:23:00 +0100 Subject: [PATCH] lib: suppress crypto related env vars in help msg This commit adds a crypto check to suppress the crypto related environment variables introduced in Commit 399bb3c95af821350774c18f469ab700387f38e1 ("doc: add NODE_DEBUG_NATIVE to API docs"). Without this check, test/parallel/test-cli-node-print-help.js will fail when configured --without-ssl, as it some of the descriptions for these environment variables contain flags that the test is not expecting to find. PR-URL: https://github.com/nodejs/node/pull/24556 Reviewed-By: Luigi Pinca Reviewed-By: Sam Roberts Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- lib/internal/print_help.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/internal/print_help.js b/lib/internal/print_help.js index c1baa643e70db2..6e904a6b18633d 100644 --- a/lib/internal/print_help.js +++ b/lib/internal/print_help.js @@ -1,6 +1,7 @@ 'use strict'; const { types } = internalBinding('options'); +const hasCrypto = Boolean(process.versions.openssl); const typeLookup = []; for (const key of Object.keys(types)) @@ -33,11 +34,6 @@ const envVars = new Map([ 'certificate validation' }], ['NODE_V8_COVERAGE', { helpText: 'directory to output v8 coverage JSON ' + 'to' }], - ['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }], - ['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' + - 'certificates when used in conjunction with --use-openssl-ca' }], - ['SSL_CERT_FILE', { helpText: 'sets OpenSSL\'s trusted certificate file ' + - 'when used in conjunction with --use-openssl-ca' }], ['UV_THREADPOOL_SIZE', { helpText: 'sets the number of threads used in ' + 'libuv\'s threadpool' }] ].concat(hasIntl ? [ @@ -46,6 +42,12 @@ const envVars = new Map([ ] : []).concat(hasNodeOptions ? [ ['NODE_OPTIONS', { helpText: 'set CLI options in the environment via a ' + 'space-separated list' }] +] : []).concat(hasCrypto ? [ + ['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }], + ['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' + + 'certificates when used in conjunction with --use-openssl-ca' }], + ['SSL_CERT_FILE', { helpText: 'sets OpenSSL\'s trusted certificate file ' + + 'when used in conjunction with --use-openssl-ca' }], ] : []));