Add environment variable for telemetry endpoint

This commit is contained in:
Asher 2019-09-05 15:26:35 -05:00
parent 9d8906d250
commit 44000459da
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
1 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import * as appInsights from "applicationinsights";
import * as https from "https";
import * as http from "http";
import * as os from "os";
export class TelemetryClient implements appInsights.TelemetryClient {
@ -35,10 +36,8 @@ export class TelemetryClient implements appInsights.TelemetryClient {
} catch (error) {}
try {
const request = https.request({
host: "v1.telemetry.coder.com",
port: 443,
path: "/track",
const url = process.env.TELEMETRY_URL || "https://v1.telemetry.coder.com/track";
const request = (/^http:/.test(url) ? http : https).request(url, {
method: "POST",
headers: {
"Content-Type": "application/json",