From cdedb681206e1ad791180c310cf5c6ef4bf2e6c4 Mon Sep 17 00:00:00 2001 From: Rahul Mishra Date: Thu, 23 Jul 2026 17:44:39 +0530 Subject: [PATCH] feat: select tunnel config endpoint by env Resolve the config endpoint (and thus AuthUrl and binaryLinks) from the env option so stage runs authenticate and download against stage. Prod remains the default, preserving current behavior. --- lib/config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/config.js b/lib/config.js index 2f82d9b..20c3874 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,10 +1,14 @@ -var httpTunnelConfigPath = 'https://downloads.lambdatest.com/tunnel/node-tunnel-config-v3-latest.json', +var prodTunnelConfigPath = 'https://downloads.lambdatest.com/tunnel/node-tunnel-config-v3-latest.json', + stageTunnelConfigPath = 'https://stage-downloads.lambdatestinternal.com/tunnel/node-tunnel-config-v3-latest.json', httpTunnelLogUrl = 'https://oinwgsy681.execute-api.us-east-1.amazonaws.com/prod/addLog', https = require('https'), urlParse = require('url'), HttpsProxyAgent = require('https-proxy-agent'), util = require('./util'); module.exports = function(options, fnCallback) { + // stage env resolves config (and thus AuthUrl + binaryLinks) to stage + var env = String(options.env || options.environment || options.e || 'prod').toLowerCase(); + var httpTunnelConfigPath = env === 'stage' ? stageTunnelConfigPath : prodTunnelConfigPath; var reqOptions = urlParse.parse(httpTunnelConfigPath); var proxyOpts = util.getProxyOpts_(options); if (Object.keys(proxyOpts).length) {