From 16d9f075b4dba67dfe113e233a3776b631cec56c Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Tue, 28 Feb 2023 16:15:17 +0000 Subject: [PATCH] grab secret from env --- pkg/services/user/userimpl/user.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/services/user/userimpl/user.go b/pkg/services/user/userimpl/user.go index 4e8a2592164..9b810eaa056 100644 --- a/pkg/services/user/userimpl/user.go +++ b/pkg/services/user/userimpl/user.go @@ -8,6 +8,7 @@ import ( "encoding/json" "errors" "fmt" + "os" "strings" "time" @@ -614,6 +615,8 @@ func buildUserAnalyticsSettings(signedInUser user.SignedInUser) user.AnalyticsSe settings.Identifier = signedInUser.Email } - settings.HashedIdentifier = hashUserIdentifier(settings.Identifier, "SECRET") + if os.Getenv("GF_ANALYTICS_SECRET") != "" { + settings.HashedIdentifier = hashUserIdentifier(settings.Identifier, os.Getenv("GF_ANALYTICS_SECRET")) + } return settings }