diff --git a/lib/interface/cli/commad-line-interface.js b/lib/interface/cli/commad-line-interface.js index f2502ec7b..9d3de5f88 100644 --- a/lib/interface/cli/commad-line-interface.js +++ b/lib/interface/cli/commad-line-interface.js @@ -60,6 +60,16 @@ async function startCommandLine() { describe: `Custom path for authentication contexts config file (default: ${DEFAULTS.CFCONFIG})`, global: false, }) + .option('insecure', { + describe: 'disable certificate validation for TLS connections (e.g. to g.codefresh.io)', + type: 'boolean', + coerce: (insecure) => { + if (insecure) { + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + } + return insecure; + }, + }) .option('request-timeout', { describe: `Request timeout (default: ${cliConfig.request.timeout})`, global: false, diff --git a/lib/interface/cli/commands/hybrid/delete.cmd.js b/lib/interface/cli/commands/hybrid/delete.cmd.js index d6876a0fe..e3bb50b96 100644 --- a/lib/interface/cli/commands/hybrid/delete.cmd.js +++ b/lib/interface/cli/commands/hybrid/delete.cmd.js @@ -87,10 +87,6 @@ const deleteCmd = new Command({ }) .option('verbose', { describe: 'Print logs', - }) - .option('insecure', { - describe: 'disable certificate validation for TLS connections (e.g. to g.codefresh.io)', - type: 'boolean', }), handler: async (argv) => { let { @@ -100,7 +96,6 @@ const deleteCmd = new Command({ 'kube-namespace': kubeNamespace, name: agentName, values: valuesFile, - insecure, } = argv; const [listReErr, runtimes] = await to(sdk.runtimeEnvs.list({ })); @@ -134,16 +129,10 @@ const deleteCmd = new Command({ if (!agentName && valuesObj.AgentId) { agentName = valuesObj.AgentId; } - if (_.isUndefined(insecure)) { - insecure = _.get(valuesObj, 'Insecure'); - } } if (!url) { url = DEFAULTS.URL; } - if (insecure) { - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - } if (!kubeContextName) { const contexts = getAllKubeContexts(kubeConfigPath); diff --git a/lib/interface/cli/commands/hybrid/init.cmd.js b/lib/interface/cli/commands/hybrid/init.cmd.js index 420db985f..06573bbcf 100644 --- a/lib/interface/cli/commands/hybrid/init.cmd.js +++ b/lib/interface/cli/commands/hybrid/init.cmd.js @@ -184,10 +184,6 @@ const initCmd = new Command({ describe: 'docker daemon access (default true)', default: true, type: 'boolean', - }) - .option('insecure', { - describe: 'disable certificate validation for TLS connections (e.g. to g.codefresh.io)', - type: 'boolean', }), handler: async (argv) => { let resumedInstallation = false; @@ -237,7 +233,6 @@ const initCmd = new Command({ url, token, name, - insecure, 'app-proxy': appProxy, 'app-proxy-host': appProxyHost, 'install-monitor': installMonitor, @@ -280,16 +275,10 @@ const initCmd = new Command({ if (_.has(valuesObj, 'dockerDaemonScheduler.userAccess')) { dockerDaemonAccess = _.get(valuesObj, 'dockerDaemonScheduler.userAccess') } - if (_.isUndefined(insecure)) { - insecure = _.get(valuesObj, 'Insecure'); - } } if (!url) { url = DEFAULTS.URL; } - if (insecure) { - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - } if (_.get(sdk, 'config.context.isNoAuth') && !token) { console.log('Not authenticated as a Codefresh account: '); diff --git a/lib/interface/cli/commands/hybrid/upgrade.cmd.js b/lib/interface/cli/commands/hybrid/upgrade.cmd.js index c588f14e0..064a40816 100644 --- a/lib/interface/cli/commands/hybrid/upgrade.cmd.js +++ b/lib/interface/cli/commands/hybrid/upgrade.cmd.js @@ -69,10 +69,6 @@ const upgradeCmd = new Command({ }) .option('verbose', { describe: 'Print logs', - }) - .option('insecure', { - describe: 'disable certificate validation for TLS connections (e.g. to g.codefresh.io)', - type: 'boolean', }), handler: async (argv) => { const { @@ -80,7 +76,6 @@ const upgradeCmd = new Command({ 'agent-name': agentName, 'install-monitor': installMonitor, verbose, - insecure, } = argv; let { 'kube-context-name': kubeContextName, @@ -88,10 +83,6 @@ const upgradeCmd = new Command({ 'runtime-name': runtimeName, } = argv; - if (insecure) { - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - } - const [listReErr, runtimes] = await to(sdk.runtimeEnvs.list({ })); await handleError(listReErr, 'Failed to get runtime environments'); const runtimesByName = runtimes.reduce((acc, cur) => ({ ...acc, [cur.metadata.name]: cur }), {}); diff --git a/package.json b/package.json index e419fbbde..4b06d3816 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.73.9", + "version": "0.73.10", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,