somratpro commited on
Commit
44ea4f8
·
1 Parent(s): 7470ebe

chore: hide outbound proxy logs by default

Browse files
Files changed (2) hide show
  1. outbound-fix.js +11 -9
  2. start.sh +0 -1
outbound-fix.js CHANGED
@@ -14,6 +14,8 @@ if (PROXY_URL && !PROXY_URL.startsWith("http://") && !PROXY_URL.startsWith("http
14
  PROXY_URL = `https://${PROXY_URL}`;
15
  }
16
 
 
 
17
  // Allow user to define what to proxy. Use "*" to proxy everything except internal HF traffic.
18
  const PROXY_DOMAINS = process.env.OUTBOUND_PROXY_DOMAINS || "api.telegram.org,discord.com,discordapp.com,gateway.discord.gg,status.discord.com";
19
  const BLOCKED_DOMAINS = PROXY_DOMAINS.split(",").map(d => d.trim());
@@ -63,7 +65,7 @@ if (PROXY_URL) {
63
  const alreadyProxied = options._proxied || (headers && headers["x-target-host"]);
64
 
65
  if (shouldProxy && !alreadyProxied) {
66
- console.log(`[outbound-fix] Redirecting ${hostname}${path} -> ${proxy.hostname}`);
67
 
68
  // 3. Create fresh options for the proxied request
69
  const newOptions = (typeof options === "string" || options instanceof URL)
@@ -101,15 +103,15 @@ if (PROXY_URL) {
101
  https.request = patch(originalHttpsRequest, true);
102
  http.request = patch(originalHttpRequest, false);
103
 
104
- if (PROXY_ALL) {
105
- console.log(`[outbound-fix] Transparent proxy active in WILDCARD mode (Proxying ALL except HF internal)`);
106
- } else {
107
- console.log(`[outbound-fix] Transparent proxy active for: ${BLOCKED_DOMAINS.join(", ")}`);
 
 
 
108
  }
109
- console.log(`[outbound-fix] Target proxy: ${proxy.hostname}`);
110
  } catch (e) {
111
- console.error(`[outbound-fix] Failed to initialize: ${e.message}`);
112
  }
113
- } else {
114
- console.log("[outbound-fix] OUTBOUND_PROXY_URL not set. Transparent proxy disabled.");
115
  }
 
14
  PROXY_URL = `https://${PROXY_URL}`;
15
  }
16
 
17
+ const DEBUG = process.env.OUTBOUND_PROXY_DEBUG === "true";
18
+
19
  // Allow user to define what to proxy. Use "*" to proxy everything except internal HF traffic.
20
  const PROXY_DOMAINS = process.env.OUTBOUND_PROXY_DOMAINS || "api.telegram.org,discord.com,discordapp.com,gateway.discord.gg,status.discord.com";
21
  const BLOCKED_DOMAINS = PROXY_DOMAINS.split(",").map(d => d.trim());
 
65
  const alreadyProxied = options._proxied || (headers && headers["x-target-host"]);
66
 
67
  if (shouldProxy && !alreadyProxied) {
68
+ if (DEBUG) console.log(`[outbound-fix] Redirecting ${hostname}${path} -> ${proxy.hostname}`);
69
 
70
  // 3. Create fresh options for the proxied request
71
  const newOptions = (typeof options === "string" || options instanceof URL)
 
103
  https.request = patch(originalHttpsRequest, true);
104
  http.request = patch(originalHttpRequest, false);
105
 
106
+ if (DEBUG) {
107
+ if (PROXY_ALL) {
108
+ console.log(`[outbound-fix] Transparent proxy active in WILDCARD mode (Proxying ALL except HF internal)`);
109
+ } else {
110
+ console.log(`[outbound-fix] Transparent proxy active for: ${BLOCKED_DOMAINS.join(", ")}`);
111
+ }
112
+ console.log(`[outbound-fix] Target proxy: ${proxy.hostname}`);
113
  }
 
114
  } catch (e) {
115
+ if (DEBUG) console.error(`[outbound-fix] Failed to initialize: ${e.message}`);
116
  }
 
 
117
  }
start.sh CHANGED
@@ -55,7 +55,6 @@ echo "n8n port : ${N8N_PORT}"
55
  echo "Public port : ${PUBLIC_PORT}"
56
  echo "Timezone : ${GENERIC_TIMEZONE}"
57
  echo "Sync every : ${SYNC_INTERVAL}s"
58
- echo "Outbound Prx: ${OUTBOUND_PROXY_URL:-not configured (Telegram/Discord may fail)}"
59
 
60
  if [ -n "${HF_TOKEN:-}" ]; then
61
  echo "Restoring persisted n8n state from HF Dataset..."
 
55
  echo "Public port : ${PUBLIC_PORT}"
56
  echo "Timezone : ${GENERIC_TIMEZONE}"
57
  echo "Sync every : ${SYNC_INTERVAL}s"
 
58
 
59
  if [ -n "${HF_TOKEN:-}" ]; then
60
  echo "Restoring persisted n8n state from HF Dataset..."