gitpreflight 0.1.17 → 0.1.19
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.
- package/lib/telemetry.js +13 -0
- package/package.json +1 -1
package/lib/telemetry.js
CHANGED
|
@@ -7,6 +7,18 @@ const crypto = require("node:crypto");
|
|
|
7
7
|
|
|
8
8
|
const DEFAULT_TELEMETRY_BASE_URL = "https://gitpreflight.ai";
|
|
9
9
|
|
|
10
|
+
function bakedTelemetryBaseUrl() {
|
|
11
|
+
try {
|
|
12
|
+
const pkg = require("../package.json");
|
|
13
|
+
const value = typeof pkg.gitpreflightTelemetryBaseUrl === "string" ? pkg.gitpreflightTelemetryBaseUrl.trim() : "";
|
|
14
|
+
return value || null;
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const BAKED_TELEMETRY_BASE_URL = bakedTelemetryBaseUrl();
|
|
21
|
+
|
|
10
22
|
function isTruthy(v) {
|
|
11
23
|
if (!v) return false;
|
|
12
24
|
const t = String(v).trim().toLowerCase();
|
|
@@ -72,6 +84,7 @@ function telemetryBaseUrl(env) {
|
|
|
72
84
|
const base =
|
|
73
85
|
(env.GITPREFLIGHT_TELEMETRY_BASE_URL && env.GITPREFLIGHT_TELEMETRY_BASE_URL.trim()) ||
|
|
74
86
|
(env.GITPREFLIGHT_API_BASE_URL && env.GITPREFLIGHT_API_BASE_URL.trim()) ||
|
|
87
|
+
BAKED_TELEMETRY_BASE_URL ||
|
|
75
88
|
DEFAULT_TELEMETRY_BASE_URL;
|
|
76
89
|
return base.replace(/\/+$/, "");
|
|
77
90
|
}
|