From aa4baa55037c4ac1e3dea1ee31737584efafe8a1 Mon Sep 17 00:00:00 2001 From: afeiszli Date: Sun, 23 Jan 2022 09:39:48 -0500 Subject: [PATCH] fixing minor things for code review --- database/database.go | 4 ++-- serverctl/telemetry.go | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/database/database.go b/database/database.go index 633e691b..b2769d1f 100644 --- a/database/database.go +++ b/database/database.go @@ -210,8 +210,8 @@ func initializeUUID() error { if err != nil { return err } - err = Insert(SERVER_UUID_RECORD_KEY, string(telJSON), SERVER_UUID_TABLE_NAME) - return err + + return Insert(SERVER_UUID_RECORD_KEY, string(telJSON), SERVER_UUID_TABLE_NAME) } // CloseDB - closes a database gracefully diff --git a/serverctl/telemetry.go b/serverctl/telemetry.go index 77e50560..fd64492c 100644 --- a/serverctl/telemetry.go +++ b/serverctl/telemetry.go @@ -12,8 +12,13 @@ import ( "github.com/posthog/posthog-go" ) +// POSTHOG_PUB_KEY - Key for sending data to PostHog const POSTHOG_PUB_KEY = "phc_1vEXhPOA1P7HP5jP2dVU9xDTUqXHAelmtravyZ1vvES" + +// POSTHOG_ENDPOINT - Endpoint of PostHog server const POSTHOG_ENDPOINT = "https://app.posthog.com" + +// TELEMETRY_HOURS_BETWEEN_SEND - How long to wait before sending telemetry to server (24 hours) const TELEMETRY_HOURS_BETWEEN_SEND = 24 // TelemetryCheckpoint - Checks if 24 hours has passed since telemetry was last sent. If so, sends telemetry data to posthog @@ -154,7 +159,7 @@ func getDBLength(dbname string) int { return len(data) } -// TelemetryData - What data to send to posthog +// telemetryData - What data to send to posthog type telemetryData struct { Nodes int ExtClients int @@ -164,7 +169,7 @@ type telemetryData struct { Version string } -// ClientCount - What types of netclients we're tallying +// clientCount - What types of netclients we're tallying type clientCount struct { MacOS int Windows int