Add environment variable for telemetry endpoint
This commit is contained in:
parent
9d8906d250
commit
44000459da
|
@ -1,5 +1,6 @@
|
||||||
import * as appInsights from "applicationinsights";
|
import * as appInsights from "applicationinsights";
|
||||||
import * as https from "https";
|
import * as https from "https";
|
||||||
|
import * as http from "http";
|
||||||
import * as os from "os";
|
import * as os from "os";
|
||||||
|
|
||||||
export class TelemetryClient implements appInsights.TelemetryClient {
|
export class TelemetryClient implements appInsights.TelemetryClient {
|
||||||
|
@ -35,10 +36,8 @@ export class TelemetryClient implements appInsights.TelemetryClient {
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const request = https.request({
|
const url = process.env.TELEMETRY_URL || "https://v1.telemetry.coder.com/track";
|
||||||
host: "v1.telemetry.coder.com",
|
const request = (/^http:/.test(url) ? http : https).request(url, {
|
||||||
port: 443,
|
|
||||||
path: "/track",
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|
Loading…
Reference in New Issue