@tech-bureau/mijin-catapult-tools 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Auto-set GLOBAL_AGENT_HTTP_PROXY if not set but HTTP_PROXY or HTTPS_PROXY is set
4
- if (!process.env.GLOBAL_AGENT_HTTP_PROXY) {
5
- const proxyUrl = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy
6
- if (proxyUrl) {
3
+ // Check if proxy is configured
4
+ const proxyUrl = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy
5
+ const hasProxy = proxyUrl && proxyUrl.trim()
6
+
7
+ if (hasProxy) {
8
+ // Auto-set GLOBAL_AGENT_HTTP_PROXY for global-agent
9
+ if (!process.env.GLOBAL_AGENT_HTTP_PROXY) {
7
10
  process.env.GLOBAL_AGENT_HTTP_PROXY = proxyUrl
8
11
  }
9
- }
10
-
11
- // Enable global-agent for proxy support
12
- if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.https_proxy) {
12
+ // Enable global-agent for proxy support
13
13
  require('global-agent/bootstrap')
14
14
  }
15
15