Skip to content

Commit 4400045

Browse files
committed
Add environment variable for telemetry endpoint
1 parent 9d8906d commit 4400045

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/insights.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as appInsights from "applicationinsights";
22
import * as https from "https";
3+
import * as http from "http";
34
import * as os from "os";
45

56
export class TelemetryClient implements appInsights.TelemetryClient {
@@ -35,10 +36,8 @@ export class TelemetryClient implements appInsights.TelemetryClient {
3536
} catch (error) {}
3637

3738
try {
38-
const request = https.request({
39-
host: "v1.telemetry.coder.com",
40-
port: 443,
41-
path: "/track",
39+
const url = process.env.TELEMETRY_URL || "https://v1.telemetry.coder.com/track";
40+
const request = (/^http:/.test(url) ? http : https).request(url, {
4241
method: "POST",
4342
headers: {
4443
"Content-Type": "application/json",

0 commit comments

Comments
 (0)